2 * Win32 ordinal only exported functions that can't be stuffed somehwere else.
4 * Copyright 1997 Marcus Meissner
11 #include "selectors.h"
20 static CRITICAL_SECTION Win16Mutex
;
21 static SEGPTR segWin16Mutex
= NULL
;
23 /***********************************************
24 * GetPWinLock (KERNEL32.93)
25 * Return the infamous Win16Mutex.
27 VOID WINAPI
GetPWinLock(CRITICAL_SECTION
**lock
)
29 fprintf(stderr
,"GetPWinlock(%p)\n",lock
);
33 /**********************************************************************
34 * WOW32_1 (KERNEL32.88)
36 BOOL32 WINAPI
WOW32_1(SEGPTR segptr
,LPLDT_ENTRY ldtent
)
38 return GetThreadSelectorEntry(GetCurrentThreadId(),segptr
>>16,ldtent
);
42 /***********************************************************************
43 * GetProcessDWORD (KERNEL32.18)
44 * 'Of course you cannot directly access Windows internal structures'
47 DWORD WINAPI
GetProcessDWORD(DWORD processid
,DWORD action
)
53 fprintf(stderr
,"KERNEL32_18(%ld,%ld+0x38)\n",processid
,action
);
56 if (!(process
= PROCESS_IdToPDB( processid
))) return 0;
58 case 0: /* return app compat flags */
59 pTask
= (TDB
*)GlobalLock16(process
->task
);
62 return pTask
->compat_flags
;
63 case 4: /* returns offset 0xb8 of process struct... dunno what it is */
65 case 8: /* return hinstance16 */
66 pTask
= (TDB
*)GlobalLock16(process
->task
);
69 return pTask
->hInstance
;
70 case 12:/* return expected windows version */
71 pTask
= (TDB
*)GlobalLock16(process
->task
);
74 return pTask
->version
;
75 case 16:/* return uncrypted pointer to current thread */
76 return (DWORD
)THREAD_Current();
77 case 20:/* return uncrypted pointer to process */
78 return (DWORD
)process
;
79 case 24:/* return stdoutput handle from startupinfo */
80 return (DWORD
)(process
->env_db
->startup_info
->hStdOutput
);
81 case 28:/* return stdinput handle from startupinfo */
82 return (DWORD
)(process
->env_db
->startup_info
->hStdInput
);
83 case 32:/* get showwindow flag from startupinfo */
84 return (DWORD
)(process
->env_db
->startup_info
->wShowWindow
);
85 case 36:{/* return startup x and y sizes */
86 LPSTARTUPINFO32A si
= process
->env_db
->startup_info
;
89 x
=si
->dwXSize
;if (x
==0x80000000) x
=0x8000;
90 y
=si
->dwYSize
;if (y
==0x80000000) y
=0x8000;
93 case 40:{/* return startup x and y */
94 LPSTARTUPINFO32A si
= process
->env_db
->startup_info
;
97 x
=si
->dwX
;if (x
==0x80000000) x
=0x8000;
98 y
=si
->dwY
;if (y
==0x80000000) y
=0x8000;
101 case 44:/* return startup flags */
102 return process
->env_db
->startup_info
->dwFlags
;
103 case 48:/* return uncrypted pointer to parent process (if any) */
104 return (DWORD
)process
->parent
;
105 case 52:/* return process flags */
106 return process
->flags
;
107 case 56:/* unexplored */
110 fprintf(stderr
,"_KERNEL32_18:unknown offset (%ld)\n",action
);
113 /* shouldn't come here */
117 /***********************************************************************
118 * GetWin16DOSEnv (KERNEL32.34)
119 * Returns some internal value.... probably the default environment database?
121 DWORD WINAPI
GetWin16DOSEnv()
123 fprintf(stderr
,"GetWin16DOSEnv(), STUB returning 0\n");
127 BOOL32 WINAPI
_KERNEL32_100(HANDLE32 threadid
,DWORD exitcode
,DWORD x
) {
128 fprintf(stderr
,"KERNEL32_100(%d,%ld,0x%08lx),stub\n",threadid
,exitcode
,x
);
132 DWORD WINAPI
_KERNEL32_99(DWORD x
) {
133 fprintf(stderr
,"KERNEL32_99(0x%08lx),stub\n",x
);
137 /************************************************************************
138 * KERNEL_449 (KERNEL.449)
139 * This returns a segmented static pointer to a linear pointer to a critical
140 * section in kernel32 address space. This is most likely the Win16 Lock,
143 SEGPTR WINAPI
KERNEL_449(void) {
144 if (!segWin16Mutex
) {
145 LPDWORD w16m
= SEGPTR_ALLOC(4);
147 *w16m
= (DWORD
)&Win16Mutex
;
148 segWin16Mutex
= SEGPTR_GET(w16m
);
150 return segWin16Mutex
;