Release 970824
[wine.git] / win32 / ordinals.c
blob28f098ffdd5d081fbee7765ee08503423db14b0e
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 "module.h"
15 #include "callback.h"
16 #include "debug.h"
17 #include "stddebug.h"
19 extern THDB *pCurrentThread;
20 extern PDB32 *pCurrentProcess;
22 static CRITICAL_SECTION Win16Mutex;
24 /***********************************************
25 * GetPWinLock (KERNEL32)
26 * Return the infamous Win16Mutex.
28 VOID WINAPI GetPWinLock(CRITICAL_SECTION **lock)
30 fprintf(stderr,"GetPWinlock(%p)\n",lock);
31 *lock = &Win16Mutex;
34 /**********************************************************************
35 * _KERNEL32_88
37 DWORD WINAPI WOW32_1(DWORD x,DWORD y)
39 fprintf(stderr,"WOW32_1(0x%08lx,0x%08lx), stub!\n",x,y);
40 return 0;
44 /***********************************************************************
45 * _KERNEL32_18 (KERNEL32.18)
46 * 'Of course you cannot directly access Windows internal structures'
49 DWORD WINAPI _KERNEL32_18(DWORD processid,DWORD action)
51 PDB32 *process;
52 TDB *pTask;
54 action+=56;
55 fprintf(stderr,"KERNEL32_18(%ld,%ld+0x38)\n",processid,action);
56 if (action>56)
57 return 0;
58 if (!processid) {
59 process=pCurrentProcess;
60 /* check if valid process */
61 } else
62 process=(PDB32*)pCurrentProcess; /* decrypt too, if needed */
63 switch (action) {
64 case 0: /* return app compat flags */
65 pTask = (TDB*)GlobalLock16(process->task);
66 if (!pTask)
67 return 0;
68 return pTask->compat_flags;
69 case 4: /* returns offset 0xb8 of process struct... dunno what it is */
70 return 0;
71 case 8: /* return hinstance16 */
72 pTask = (TDB*)GlobalLock16(process->task);
73 if (!pTask)
74 return 0;
75 return pTask->hInstance;
76 case 12:/* return expected windows version */
77 pTask = (TDB*)GlobalLock16(process->task);
78 if (!pTask)
79 return 0;
80 return pTask->version;
81 case 16:/* return uncrypted pointer to current thread */
82 return (DWORD)pCurrentThread;
83 case 20:/* return uncrypted pointer to process */
84 return (DWORD)process;
85 case 24:/* return stdoutput handle from startupinfo */
86 return (DWORD)(process->env_db->startup_info->hStdOutput);
87 case 28:/* return stdinput handle from startupinfo */
88 return (DWORD)(process->env_db->startup_info->hStdInput);
89 case 32:/* get showwindow flag from startupinfo */
90 return (DWORD)(process->env_db->startup_info->wShowWindow);
91 case 36:{/* return startup x and y sizes */
92 LPSTARTUPINFO32A si = process->env_db->startup_info;
93 DWORD x,y;
95 x=si->dwXSize;if (x==0x80000000) x=0x8000;
96 y=si->dwYSize;if (y==0x80000000) y=0x8000;
97 return (y<<16)+x;
99 case 40:{/* return startup x and y */
100 LPSTARTUPINFO32A si = process->env_db->startup_info;
101 DWORD x,y;
103 x=si->dwX;if (x==0x80000000) x=0x8000;
104 y=si->dwY;if (y==0x80000000) y=0x8000;
105 return (y<<16)+x;
107 case 44:/* return startup flags */
108 return process->env_db->startup_info->dwFlags;
109 case 48:/* return uncrypted pointer to parent process (if any) */
110 return (DWORD)process->parent;
111 case 52:/* return process flags */
112 return process->flags;
113 case 56:/* unexplored */
114 return 0;
115 default:
116 fprintf(stderr,"_KERNEL32_18:unknown offset (%ld)\n",action);
117 return 0;
119 /* shouldn't come here */
123 /***********************************************************************
124 * (KERNEL32.33)
125 * Returns some internal value.... probably the default environment database?
127 DWORD WINAPI _KERNEL32_34()
129 fprintf(stderr,"KERNEL32_34(), STUB returning 0\n");
130 return 0;