Release 980104
[wine/multimedia.git] / win32 / ordinals.c
blob56d2f9f3f6f0fe59c06ae552d457390ba9878115
1 /*
2 * Win32 ordinal only exported functions that can't be stuffed somehwere else.
4 * Copyright 1997 Marcus Meissner
5 */
7 #include <stdio.h>
8 #include "thread.h"
9 #include "winerror.h"
10 #include "heap.h"
11 #include "selectors.h"
12 #include "miscemu.h"
13 #include "winnt.h"
14 #include "process.h"
15 #include "module.h"
16 #include "callback.h"
17 #include "debug.h"
18 #include "stddebug.h"
20 static CRITICAL_SECTION Win16Mutex;
22 /***********************************************
23 * GetPWinLock (KERNEL32)
24 * Return the infamous Win16Mutex.
26 VOID WINAPI GetPWinLock(CRITICAL_SECTION **lock)
28 fprintf(stderr,"GetPWinlock(%p)\n",lock);
29 *lock = &Win16Mutex;
32 /**********************************************************************
33 * _KERNEL32_88
35 BOOL32 WINAPI WOW32_1(SEGPTR segptr,LPLDT_ENTRY ldtent)
37 return GetThreadSelectorEntry(GetCurrentThreadId(),segptr>>16,ldtent);
41 /***********************************************************************
42 * _KERNEL32_18 (KERNEL32.18)
43 * 'Of course you cannot directly access Windows internal structures'
46 DWORD WINAPI _KERNEL32_18(DWORD processid,DWORD action)
48 PDB32 *process;
49 TDB *pTask;
51 action+=56;
52 fprintf(stderr,"KERNEL32_18(%ld,%ld+0x38)\n",processid,action);
53 if (action>56)
54 return 0;
55 if (!processid) {
56 process=pCurrentProcess;
57 /* check if valid process */
58 } else
59 process=(PDB32*)pCurrentProcess; /* decrypt too, if needed */
60 switch (action) {
61 case 0: /* return app compat flags */
62 pTask = (TDB*)GlobalLock16(process->task);
63 if (!pTask)
64 return 0;
65 return pTask->compat_flags;
66 case 4: /* returns offset 0xb8 of process struct... dunno what it is */
67 return 0;
68 case 8: /* return hinstance16 */
69 pTask = (TDB*)GlobalLock16(process->task);
70 if (!pTask)
71 return 0;
72 return pTask->hInstance;
73 case 12:/* return expected windows version */
74 pTask = (TDB*)GlobalLock16(process->task);
75 if (!pTask)
76 return 0;
77 return pTask->version;
78 case 16:/* return uncrypted pointer to current thread */
79 return (DWORD)THREAD_Current();
80 case 20:/* return uncrypted pointer to process */
81 return (DWORD)process;
82 case 24:/* return stdoutput handle from startupinfo */
83 return (DWORD)(process->env_db->startup_info->hStdOutput);
84 case 28:/* return stdinput handle from startupinfo */
85 return (DWORD)(process->env_db->startup_info->hStdInput);
86 case 32:/* get showwindow flag from startupinfo */
87 return (DWORD)(process->env_db->startup_info->wShowWindow);
88 case 36:{/* return startup x and y sizes */
89 LPSTARTUPINFO32A si = process->env_db->startup_info;
90 DWORD x,y;
92 x=si->dwXSize;if (x==0x80000000) x=0x8000;
93 y=si->dwYSize;if (y==0x80000000) y=0x8000;
94 return (y<<16)+x;
96 case 40:{/* return startup x and y */
97 LPSTARTUPINFO32A si = process->env_db->startup_info;
98 DWORD x,y;
100 x=si->dwX;if (x==0x80000000) x=0x8000;
101 y=si->dwY;if (y==0x80000000) y=0x8000;
102 return (y<<16)+x;
104 case 44:/* return startup flags */
105 return process->env_db->startup_info->dwFlags;
106 case 48:/* return uncrypted pointer to parent process (if any) */
107 return (DWORD)process->parent;
108 case 52:/* return process flags */
109 return process->flags;
110 case 56:/* unexplored */
111 return 0;
112 default:
113 fprintf(stderr,"_KERNEL32_18:unknown offset (%ld)\n",action);
114 return 0;
116 /* shouldn't come here */
120 /***********************************************************************
121 * (KERNEL32.33)
122 * Returns some internal value.... probably the default environment database?
124 DWORD WINAPI _KERNEL32_34()
126 fprintf(stderr,"KERNEL32_34(), STUB returning 0\n");
127 return 0;
130 BOOL32 WINAPI _KERNEL32_99(HANDLE32 threadid,DWORD exitcode,DWORD x) {
131 fprintf(stderr,"KERNEL32_99(%d,%ld,0x%08lx),stub\n",threadid,exitcode,x);
132 return TRUE;
135 DWORD WINAPI _KERNEL32_98(DWORD x) {
136 fprintf(stderr,"KERNEL32_98(0x%08lx),stub\n",x);
137 return 1;