Release 980809
[wine] / win32 / ordinals.c
1 /*
2  * Win32 ordinal only exported functions that can't be stuffed somehwere else.
3  *
4  * Copyright 1997 Marcus Meissner
5  */
6
7 #include "thread.h"
8 #include "winerror.h"
9 #include "heap.h"
10 #include "selectors.h"
11 #include "miscemu.h"
12 #include "winnt.h"
13 #include "process.h"
14 #include "module.h"
15 #include "task.h"
16 #include "callback.h"
17 #include "debug.h"
18
19 /**********************************************************************
20  *           WOWGetDescriptor        (KERNEL32.88) (WOW32.1)
21  */
22 BOOL32 WINAPI WOWGetDescriptor(SEGPTR segptr,LPLDT_ENTRY ldtent)
23 {
24     return GetThreadSelectorEntry(GetCurrentThreadId(),segptr>>16,ldtent);
25 }
26
27
28 /***********************************************************************
29  *           GetProcessDword    (KERNEL32.18)
30  * 'Of course you cannot directly access Windows internal structures'
31  */
32 DWORD WINAPI GetProcessDword(DWORD processid,DWORD action)
33 {
34         PDB32   *process = processid? PROCESS_IdToPDB( processid )
35                                     : PROCESS_Current();
36         TDB     *pTask;
37
38         action+=56;
39         TRACE(win32,"(%ld,%ld+0x38)\n",processid,action);
40         if (!process || action>56)
41                 return 0;
42         switch (action) {
43         case 0: /* return app compat flags */
44                 pTask = (TDB*)GlobalLock16(process->task);
45                 if (!pTask)
46                         return 0;
47                 return pTask->compat_flags;
48         case 4: /* returns offset 0xb8 of process struct... dunno what it is */
49                 return 0;
50         case 8: /* return hinstance16 */
51                 pTask = (TDB*)GlobalLock16(process->task);
52                 if (!pTask)
53                         return 0;
54                 return pTask->hInstance;
55         case 12:/* return expected windows version */
56                 pTask = (TDB*)GlobalLock16(process->task);
57                 if (!pTask)
58                         return 0;
59                 return pTask->version;
60         case 16:/* return uncrypted pointer to current thread */
61                 return (DWORD)THREAD_Current();
62         case 20:/* return uncrypted pointer to process */
63                 return (DWORD)process;
64         case 24:/* return stdoutput handle from startupinfo */
65                 return (DWORD)(process->env_db->startup_info->hStdOutput);
66         case 28:/* return stdinput handle from startupinfo */
67                 return (DWORD)(process->env_db->startup_info->hStdInput);
68         case 32:/* get showwindow flag from startupinfo */
69                 return (DWORD)(process->env_db->startup_info->wShowWindow);
70         case 36:{/* return startup x and y sizes */
71                 LPSTARTUPINFO32A si = process->env_db->startup_info;
72                 DWORD x,y;
73
74                 x=si->dwXSize;if (x==0x80000000) x=0x8000;
75                 y=si->dwYSize;if (y==0x80000000) y=0x8000;
76                 return (y<<16)+x;
77         }
78         case 40:{/* return startup x and y */
79                 LPSTARTUPINFO32A si = process->env_db->startup_info;
80                 DWORD x,y;
81
82                 x=si->dwX;if (x==0x80000000) x=0x8000;
83                 y=si->dwY;if (y==0x80000000) y=0x8000;
84                 return (y<<16)+x;
85         }
86         case 44:/* return startup flags */
87                 return process->env_db->startup_info->dwFlags;
88         case 48:/* return uncrypted pointer to parent process (if any) */
89                 return (DWORD)process->parent;
90         case 52:/* return process flags */
91                 return process->flags;
92         case 56:/* unexplored */
93                 return 0;
94         default:
95                 WARN(win32,"Unknown offset (%ld)\n",action);
96                 return 0;
97         }
98         /* shouldn't come here */
99 }
100
101 /***********************************************************************
102  *              GetWin16DOSEnv                  (KERNEL32.34)
103  * Returns some internal value.... probably the default environment database?
104  */
105 DWORD WINAPI GetWin16DOSEnv()
106 {
107         FIXME(dosmem,"stub, returning 0\n");
108         return 0;
109 }
110
111 /**********************************************************************
112  *           GetPK16SysVar    (KERNEL32.92)
113  */
114 LPVOID WINAPI GetPK16SysVar(void)
115 {
116     static BYTE PK16SysVar[128];
117
118     FIXME(win32, "()\n");
119     return PK16SysVar;
120 }
121
122
123 BOOL32 WINAPI _KERNEL32_100(HANDLE32 threadid,DWORD exitcode,DWORD x) {
124         FIXME(thread,"(%d,%ld,0x%08lx): stub\n",threadid,exitcode,x);
125         return TRUE;
126 }
127
128 DWORD WINAPI _KERNEL32_99(DWORD x) {
129         FIXME(win32,"(0x%08lx): stub\n",x);
130         return 1;
131 }
132