2 * Win32 ordinal only exported functions that can't be stuffed somehwere else.
4 * Copyright 1997 Marcus Meissner
10 #include "selectors.h"
19 static CRITICAL_SECTION Win16Mutex
;
20 static SEGPTR segWin16Mutex
= (SEGPTR
)NULL
;
23 /***********************************************
24 * GetpWin16Lock (KERNEL32.93)
25 * Return the infamous Win16Mutex.
27 VOID WINAPI
GetpWin16Lock(CRITICAL_SECTION
**lock
)
29 FIXME(win32
, "(%p)\n",lock
);
33 /***********************************************
34 * _ConfirmWin16Lock (KERNEL32.96)
36 DWORD WINAPI
_ConfirmWin16Lock(void)
42 /***********************************************
43 * _EnterSysLevel (KERNEL32.97)
45 VOID WINAPI
_EnterSysLevel(CRITICAL_SECTION
*lock
)
47 FIXME(win32
, "(%p)\n", lock
);
50 /***********************************************
51 * _EnterSysLevel (KERNEL32.98)
53 VOID WINAPI
_LeaveSysLevel(CRITICAL_SECTION
*lock
)
55 FIXME(win32
, "(%p)\n", lock
);
58 /***********************************************
59 * ReleaseThunkLock (KERNEL32.48)
61 VOID WINAPI
ReleaseThunkLock(DWORD
*mutex_count
)
63 _LeaveSysLevel(&Win16Mutex
);
65 *mutex_count
= (DWORD
) NtCurrentTeb()->mutex_count
;
66 NtCurrentTeb()->mutex_count
= 0xFFFF;
69 /***********************************************
70 * RestoreThunkLock (KERNEL32.49)
72 VOID WINAPI
RestoreThunkLock(DWORD mutex_count
)
74 NtCurrentTeb()->mutex_count
= (WORD
)mutex_count
;
76 _EnterSysLevel(&Win16Mutex
);
79 /***********************************************
80 * GetPK16SysVar (KERNEL32.92)
82 LPVOID WINAPI
GetPK16SysVar(void)
84 static BYTE PK16SysVar
[128];
91 /**********************************************************************
92 * WOWGetDescriptor (KERNEL32.88) (WOW32.1)
94 BOOL32 WINAPI
WOWGetDescriptor(SEGPTR segptr
,LPLDT_ENTRY ldtent
)
96 return GetThreadSelectorEntry(GetCurrentThreadId(),segptr
>>16,ldtent
);
100 /***********************************************************************
101 * GetProcessDword (KERNEL32.18)
102 * 'Of course you cannot directly access Windows internal structures'
104 DWORD WINAPI
GetProcessDword(DWORD processid
,DWORD action
)
106 PDB32
*process
= processid
? PROCESS_IdToPDB( processid
)
111 TRACE(win32
,"(%ld,%ld+0x38)\n",processid
,action
);
112 if (!process
|| action
>56)
115 case 0: /* return app compat flags */
116 pTask
= (TDB
*)GlobalLock16(process
->task
);
119 return pTask
->compat_flags
;
120 case 4: /* returns offset 0xb8 of process struct... dunno what it is */
122 case 8: /* return hinstance16 */
123 pTask
= (TDB
*)GlobalLock16(process
->task
);
126 return pTask
->hInstance
;
127 case 12:/* return expected windows version */
128 pTask
= (TDB
*)GlobalLock16(process
->task
);
131 return pTask
->version
;
132 case 16:/* return uncrypted pointer to current thread */
133 return (DWORD
)THREAD_Current();
134 case 20:/* return uncrypted pointer to process */
135 return (DWORD
)process
;
136 case 24:/* return stdoutput handle from startupinfo */
137 return (DWORD
)(process
->env_db
->startup_info
->hStdOutput
);
138 case 28:/* return stdinput handle from startupinfo */
139 return (DWORD
)(process
->env_db
->startup_info
->hStdInput
);
140 case 32:/* get showwindow flag from startupinfo */
141 return (DWORD
)(process
->env_db
->startup_info
->wShowWindow
);
142 case 36:{/* return startup x and y sizes */
143 LPSTARTUPINFO32A si
= process
->env_db
->startup_info
;
146 x
=si
->dwXSize
;if (x
==0x80000000) x
=0x8000;
147 y
=si
->dwYSize
;if (y
==0x80000000) y
=0x8000;
150 case 40:{/* return startup x and y */
151 LPSTARTUPINFO32A si
= process
->env_db
->startup_info
;
154 x
=si
->dwX
;if (x
==0x80000000) x
=0x8000;
155 y
=si
->dwY
;if (y
==0x80000000) y
=0x8000;
158 case 44:/* return startup flags */
159 return process
->env_db
->startup_info
->dwFlags
;
160 case 48:/* return uncrypted pointer to parent process (if any) */
161 return (DWORD
)process
->parent
;
162 case 52:/* return process flags */
163 return process
->flags
;
164 case 56:/* unexplored */
167 WARN(win32
,"Unknown offset (%ld)\n",action
);
170 /* shouldn't come here */
173 /***********************************************************************
174 * GetWin16DOSEnv (KERNEL32.34)
175 * Returns some internal value.... probably the default environment database?
177 DWORD WINAPI
GetWin16DOSEnv()
179 FIXME(dosmem
,"stub, returning 0\n");
183 BOOL32 WINAPI
_KERNEL32_100(HANDLE32 threadid
,DWORD exitcode
,DWORD x
) {
184 FIXME(thread
,"(%d,%ld,0x%08lx): stub\n",threadid
,exitcode
,x
);
188 DWORD WINAPI
_KERNEL32_99(DWORD x
) {
189 FIXME(win32
,"(0x%08lx): stub\n",x
);
193 /************************************************************************
194 * KERNEL_449 (KERNEL.449)
195 * This returns a segmented static pointer to a linear pointer to a critical
196 * section in kernel32 address space. This is most likely the Win16 Lock,
199 SEGPTR WINAPI
KERNEL_449(void) {
200 if (!segWin16Mutex
) {
201 LPDWORD w16m
= SEGPTR_ALLOC(4);
203 *w16m
= (DWORD
)&Win16Mutex
;
204 segWin16Mutex
= SEGPTR_GET(w16m
);
206 return segWin16Mutex
;