ReactOS  0.4.13-dev-563-g0561610
dllmain.c File Reference
#include <user32.h>
#include <ndk/cmfuncs.h>
Include dependency graph for dllmain.c:

Go to the source code of this file.

Classes

struct  _UMPDPKTHEAD
 

Macros

#define MAX_USER_MODE_DRV_BUFFER   526
 
#define KEY_LENGTH   1024
 
#define WIN_OBJ_DIR   L"\\Windows"
 
#define SESSION_DIR   L"\\Sessions"
 

Typedefs

typedef struct _UMPDPKTHEAD UMPDPKTHEAD
 
typedef struct _UMPDPKTHEADPUMPDPKTHEAD
 

Functions

INT WINAPI GdiPrinterThunk (PUMPDPKTHEAD, PVOID, INT)
 
 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
BOOL GetDllList (VOID)
 
VOID LoadAppInitDlls (VOID)
 
VOID UnloadAppInitDlls (VOID)
 
VOID WINAPI GdiProcessSetup (VOID)
 
BOOL WINAPI ClientThreadSetupHelper (BOOL IsCallback)
 
BOOL WINAPI ClientThreadSetup (VOID)
 
BOOL Init (PUSERCONNECT UserCon)
 
VOID Cleanup (VOID)
 
INT WINAPI DllMain (IN PVOID hInstanceDll, IN ULONG dwReason, IN PVOID reserved)
 
NTSTATUS WINAPI User32CallClientThreadSetupFromKernel (PVOID Arguments, ULONG ArgumentLength)
 
NTSTATUS WINAPI User32CallGetCharsetInfo (PVOID Arguments, ULONG ArgumentLength)
 
NTSTATUS WINAPI User32CallSetWndIconsFromKernel (PVOID Arguments, ULONG ArgumentLength)
 
NTSTATUS WINAPI User32DeliverUserAPC (PVOID Arguments, ULONG ArgumentLength)
 
NTSTATUS WINAPI User32CallOBMFromKernel (PVOID Arguments, ULONG ArgumentLength)
 
NTSTATUS WINAPI User32CallLPKFromKernel (PVOID Arguments, ULONG ArgumentLength)
 
NTSTATUS WINAPI User32CallUMPDFromKernel (PVOID Arguments, ULONG ArgumentLength)
 

Variables

static ULONG User32TlsIndex
 
HINSTANCE User32Instance
 
PPROCESSINFO g_ppi = NULL
 
PUSER_HANDLE_TABLE gHandleTable = NULL
 
PUSER_HANDLE_ENTRY gHandleEntries = NULL
 
PSERVERINFO gpsi = NULL
 
SHAREDINFO gSharedInfo = {0}
 
ULONG_PTR g_ulSharedDelta
 
BOOLEAN gfLogonProcess = FALSE
 
BOOLEAN gfServerProcess = FALSE
 
BOOLEAN gfFirstThread = TRUE
 
HICON hIconSmWindows = NULL
 
HICON hIconWindows = NULL
 
WCHAR szAppInit [KEY_LENGTH]
 
PVOID apfnDispatch [USER32_CALLBACK_MAXIMUM+1]
 

Macro Definition Documentation

◆ KEY_LENGTH

#define KEY_LENGTH   1024

Definition at line 24 of file dllmain.c.

◆ MAX_USER_MODE_DRV_BUFFER

#define MAX_USER_MODE_DRV_BUFFER   526

Definition at line 5 of file dllmain.c.

◆ SESSION_DIR

#define SESSION_DIR   L"\\Sessions"

◆ WIN_OBJ_DIR

#define WIN_OBJ_DIR   L"\\Windows"

Typedef Documentation

◆ PUMPDPKTHEAD

◆ UMPDPKTHEAD

Function Documentation

◆ Cleanup()

VOID Cleanup ( VOID  )

Definition at line 458 of file dllmain.c.

459 {
462  MenuCleanup();
463  MessageCleanup();
466 }
CRITICAL_SECTION U32AccelCacheLock
Definition: accel.c:54
VOID UnloadAppInitDlls(VOID)
Definition: dllmain.c:175
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1116
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
static ULONG User32TlsIndex
Definition: dllmain.c:26
VOID DeleteFrameBrushes(VOID)
Definition: paint.c:71
VOID FASTCALL MessageCleanup(VOID)
Definition: message.c:3281
VOID MenuCleanup(VOID)
Definition: menu.c:649

Referenced by DllMain().

◆ ClientThreadSetup()

BOOL WINAPI ClientThreadSetup ( VOID  )

Definition at line 345 of file dllmain.c.

346 {
347  //
348  // This routine, in Windows, does a lot of what Init does, but in a radically
349  // different way.
350  //
351  // In Windows, because CSRSS's threads have TIF_CSRSSTHREAD set (we have this
352  // flag in ROS but not sure if we use it), the xxxClientThreadSetup callback
353  // isn't made when CSRSS first loads WINSRV.DLL (which loads USER32.DLL).
354  //
355  // However, all the other calls are made as normal, and WINSRV.DLL loads
356  // USER32.dll, the DllMain runs, and eventually the first NtUser system call is
357  // made which initializes Win32k (and initializes the thread, but as mentioned
358  // above, the thread is marked as TIF_CSRSSTHREAD).
359  //
360  // In the DllMain of User32, there is also a CsrClientConnectToServer call to
361  // server 2 (winsrv). When this is done from CSRSS, the "InServer" flag is set,
362  // so user32 will remember that it's running inside of CSRSS. Also, another
363  // flag, called "FirstThread" is manually set by DllMain.
364  //
365  // Then, WINSRV finishes loading, and CSRSRV starts the API thread/loop. This
366  // code then calls CsrConnectToUser, which calls... ClientThreadStartup. Now
367  // this routine detects that it's in the server process, which means it's CSRSS
368  // and that the callback never happened. It does some first-time-Win32k connection
369  // initialization and caches a bunch of things -- if it's the first thread. It also
370  // acquires a critical section to initialize GDI -- and then resets the first thread
371  // flag.
372  //
373  // For now, we'll do none of this, but to support Windows' CSRSRV.DLL which calls
374  // CsrConnectToUser, we'll pretend we "did something" here. Then the rest will
375  // continue as normal.
376  //
377 
378  // FIXME: Disabling this call is a HACK!! See also User32CallClientThreadSetupFromKernel...
379  // return ClientThreadSetupHelper(FALSE);
380  TRACE("ClientThreadSetup is not implemented\n");
381  return TRUE;
382 }
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4

◆ ClientThreadSetupHelper()

BOOL WINAPI ClientThreadSetupHelper ( BOOL  IsCallback)

Definition at line 237 of file dllmain.c.

238 {
239  /*
240  * Normally we are called by win32k so the win32 thread pointers
241  * should be valid as they are set in win32k::InitThreadCallback.
242  */
245 
246  TRACE("In ClientThreadSetup(IsCallback == %s, gfServerProcess = %s, IsFirstThread = %s)\n",
247  IsCallback ? "TRUE" : "FALSE", gfServerProcess ? "TRUE" : "FALSE", IsFirstThread ? "TRUE" : "FALSE");
248 
249  if (IsFirstThread)
250  GdiProcessSetup();
251 
252  /* Check for already initialized thread, and bail out if so */
253  if (ClientInfo->CI_flags & CI_INITTHREAD)
254  {
255  ERR("ClientThreadSetup: Thread already initialized.\n");
256  return FALSE;
257  }
258 
259  /*
260  * CSRSS couldn't use user32::DllMain CSR server-to-server call to connect
261  * to win32k. So it is delayed to a manually-call to ClientThreadSetup.
262  * Also this needs to be done only for the first thread (since the connection
263  * is per-process).
264  */
265  if (gfServerProcess && IsFirstThread)
266  {
268  USERCONNECT UserCon;
269 
270  RtlZeroMemory(&UserCon, sizeof(UserCon));
271 
272  /* Minimal setup of the connect info structure */
273  UserCon.ulVersion = USER_VERSION;
274 
275  /* Connect to win32k */
277  &UserCon,
278  sizeof(UserCon));
279  if (!NT_SUCCESS(Status)) return FALSE;
280 
281  /* Retrieve data */
282  g_ppi = ClientInfo->ppi; // Snapshot PI, used as pointer only!
284  gpsi = SharedPtrToUser(UserCon.siClient.psi);
287  gSharedInfo = UserCon.siClient;
288 
289  // ERR("1 SI 0x%x : HT 0x%x : D 0x%x\n", UserCon.siClient.psi, UserCon.siClient.aheList, g_ulSharedDelta);
290  }
291 
292  TRACE("Checkpoint (register PFN)\n");
293  if (!RegisterClientPFN())
294  {
295  ERR("RegisterClientPFN failed\n");
296  return FALSE;
297  }
298 
299  /* Mark this thread as initialized */
300  ClientInfo->CI_flags |= CI_INITTHREAD;
301 
302  /* Initialization that should be done once per process */
303  if (IsFirstThread)
304  {
305  TRACE("Checkpoint (Allocating TLS)\n");
306 
307  /* Allocate an index for user32 thread local data */
310  return FALSE;
311 
312  // HAAAAAAAAAACK!!!!!!
313  // ASSERT(gpsi);
314  if (!gpsi) ERR("AAAAAAAAAAAHHHHHHHHHHHHHH!!!!!!!! gpsi == NULL !!!!\n");
315  if (gpsi)
316  {
317  TRACE("Checkpoint (MessageInit)\n");
318 
319  if (MessageInit())
320  {
321  TRACE("Checkpoint (MenuInit)\n");
322  if (MenuInit())
323  {
324  TRACE("Checkpoint initialization done OK\n");
326  LoadAppInitDlls();
327  return TRUE;
328  }
329  MessageCleanup();
330  }
331 
333  return FALSE;
334  }
335  }
336 
337  return TRUE;
338 }
signed char * PCHAR
Definition: retypes.h:7
BOOL MenuInit(VOID)
Definition: menu.c:363
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define USER_VERSION
Definition: ntuser.h:1098
#define GetWin32ClientInfo()
Definition: ntuser.h:320
PUSER_HANDLE_TABLE gHandleTable
Definition: dllmain.c:30
PUSER_HANDLE_ENTRY gHandleEntries
Definition: dllmain.c:31
char _InterlockedExchange8(_Interlocked_operand_ char volatile *_Target, char _Value)
CLIENT_DATA ClientInfo
#define CI_INITTHREAD
Definition: ntuser.h:280
VOID WINAPI GdiProcessSetup(VOID)
Definition: dllmain.c:41
VOID LoadAppInitDlls(VOID)
Definition: dllmain.c:142
unsigned char BOOLEAN
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
CRITICAL_SECTION U32AccelCacheLock
Definition: accel.c:54
BOOL WINAPI RegisterClientPFN(VOID)
Definition: regcontrol.c:143
#define NtCurrentProcess()
Definition: nt_native.h:1657
PSERVERINFO psi
Definition: ntuser.h:1079
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1116
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG ulVersion
Definition: ntuser.h:1091
static ULONG User32TlsIndex
Definition: dllmain.c:26
BOOLEAN gfServerProcess
Definition: dllmain.c:36
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1050
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:530
ULONG_PTR ulSharedDelta
Definition: ntuser.h:1082
Status
Definition: gdiplustypes.h:24
VOID FASTCALL MessageCleanup(VOID)
Definition: message.c:3281
#define ERR(fmt,...)
Definition: debug.h:109
SHAREDINFO siClient
Definition: ntuser.h:1094
PUSER_HANDLE_ENTRY handles
Definition: ntuser.h:35
PPROCESSINFO g_ppi
Definition: dllmain.c:29
static __inline PVOID SharedPtrToUser(PVOID Ptr)
Definition: user_x.h:4
BOOL FASTCALL MessageInit(VOID)
Definition: message.c:3273
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
SHAREDINFO gSharedInfo
Definition: dllmain.c:33
BOOLEAN gfFirstThread
Definition: dllmain.c:37
ULONG_PTR g_ulSharedDelta
Definition: dllmain.c:34
NTSTATUS NTAPI NtUserProcessConnect(IN HANDLE ProcessHandle, OUT PUSERCONNECT pUserConnect, IN ULONG Size)
Definition: ntstubs.c:529
PVOID aheList
Definition: ntuser.h:1080
PSERVERINFO gpsi
Definition: dllmain.c:32

Referenced by Init().

◆ DllMain()

INT WINAPI DllMain ( IN PVOID  hInstanceDll,
IN ULONG  dwReason,
IN PVOID  reserved 
)

Definition at line 469 of file dllmain.c.

473 {
474  switch (dwReason)
475  {
476  case DLL_PROCESS_ATTACH:
477  {
478 
479 #define WIN_OBJ_DIR L"\\Windows"
480 #define SESSION_DIR L"\\Sessions"
481 
482  USERSRV_API_CONNECTINFO ConnectInfo; // USERCONNECT
483 
484 #if 0 // Disabling this code is a BIG HACK!!
485 
487  ULONG ConnectInfoSize = sizeof(ConnectInfo);
488  WCHAR SessionDir[256];
489 
490  /* Cache the PEB and Session ID */
491  PPEB Peb = NtCurrentPeb();
492  ULONG SessionId = Peb->SessionId; // gSessionId
493 
494  TRACE("user32::DllMain\n");
495 
496  /* Don't bother us for each thread */
497  DisableThreadLibraryCalls(hInstanceDll);
498 
499  RtlZeroMemory(&ConnectInfo, sizeof(ConnectInfo));
500 
501  /* Minimal setup of the connect info structure */
502  ConnectInfo.ulVersion = USER_VERSION;
503 
504  /* Setup the Object Directory path */
505  if (!SessionId)
506  {
507  /* Use the raw path */
508  wcscpy(SessionDir, WIN_OBJ_DIR);
509  }
510  else
511  {
512  /* Use the session path */
513  swprintf(SessionDir,
514  L"%ws\\%ld%ws",
515  SESSION_DIR,
516  SessionId,
517  WIN_OBJ_DIR);
518  }
519 
520  TRACE("Checkpoint (call CSR)\n");
521 
522  /* Connect to the USER Server */
523  Status = CsrClientConnectToServer(SessionDir,
525  &ConnectInfo,
526  &ConnectInfoSize,
527  &gfServerProcess);
528  if (!NT_SUCCESS(Status))
529  {
530  ERR("Failed to connect to CSR (Status %lx)\n", Status);
531  return FALSE;
532  }
533 
534  TRACE("Checkpoint (CSR called)\n");
535 
536 #endif
537 
538  User32Instance = hInstanceDll;
539 
540  /* Finish initialization */
541  TRACE("Checkpoint (call Init)\n");
542  if (!Init(&ConnectInfo))
543  return FALSE;
544 
545  if (!gfServerProcess)
546  {
547 #if WIN32K_ISNT_BROKEN
549 #else
550  /* imm32 takes a refcount and prevents us from unloading */
551  LoadLibraryW(L"user32");
552 #endif
553  //
554  // Wine is stub and throws an exception so save this for real Imm32.dll testing!!!!
555  //
556  //gImmApiEntries.pImmRegisterClient(&gSharedInfo, ghImm32);
557  }
558 
559  break;
560  }
561 
562  case DLL_PROCESS_DETACH:
563  {
564  if (ghImm32)
566 
567  Cleanup();
568  break;
569  }
570  }
571 
572  /* Finally, initialize GDI */
573  return GdiDllInitialize(hInstanceDll, dwReason, reserved);
574 }
#define WIN_OBJ_DIR
PPEB Peb
Definition: dllmain.c:27
HINSTANCE ghImm32
Definition: imm.c:22
BOOL WINAPI InitializeImmEntryTable(VOID)
Definition: imm.c:183
#define USERSRV_SERVERDLL_INDEX
Definition: winmsg.h:15
ULONG SessionId
Definition: dllmain.c:28
LONG NTSTATUS
Definition: precomp.h:26
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define USER_VERSION
Definition: ntuser.h:1098
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
BOOL Init(PUSERCONNECT UserCon)
Definition: dllmain.c:385
HINSTANCE User32Instance
Definition: dllmain.c:27
DWORD dwReason
Definition: misc.cpp:154
r reserved
Definition: btrfs.c:2704
#define LoadLibraryW(x)
Definition: compat.h:404
VOID Cleanup(VOID)
Definition: dllmain.c:458
#define SESSION_DIR
#define DLL_PROCESS_DETACH
Definition: compat.h:119
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:405
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define USERSRV_API_CONNECTINFO
Definition: winmsg.h:40
#define swprintf(buf, format,...)
Definition: sprintf.c:56
BOOL WINAPI GdiDllInitialize(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
Definition: dllmain.c:71
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
ULONG SessionId
Definition: btrfs_drv.h:1874
static const WCHAR L[]
Definition: oid.c:1250
BOOLEAN gfServerProcess
Definition: dllmain.c:36
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
#define NtCurrentPeb()
Definition: FLS.c:20
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NTSTATUS NTAPI CsrClientConnectToServer(IN PWSTR ObjectDirectory, IN ULONG ServerId, IN PVOID ConnectionInfo, IN OUT PULONG ConnectionInfoSize, OUT PBOOLEAN ServerToServerCall)
Definition: connect.c:192

◆ GdiPrinterThunk()

INT WINAPI GdiPrinterThunk ( PUMPDPKTHEAD  ,
PVOID  ,
INT   
)

◆ GdiProcessSetup()

VOID WINAPI GdiProcessSetup ( VOID  )

Definition at line 41 of file dllmain.c.

42 {
44 
45  /* map the gdi handle table to user space */
46  GdiHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
47  GdiSharedHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
49  CurrentProcessId = NtCurrentTeb()->ClientId.UniqueProcess;
50  GDI_BatchLimit = (DWORD) NtCurrentTeb()->ProcessEnvironmentBlock->GdiDCAttributeList;
51  GdiHandleCache = (PGDIHANDLECACHE)NtCurrentTeb()->ProcessEnvironmentBlock->GdiHandleBuffer;
55 }
DWORD GDI_BatchLimit
Definition: misc.c:36
#define DWORD
Definition: nt_native.h:44
VOID WINAPI GdiInitializeLanguagePack(_In_ DWORD InitParam)
PGDIHANDLECACHE GdiHandleCache
Definition: dllmain.c:10
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
CRITICAL_SECTION gcsClientObjLinks
Definition: clientobj.c:10
HANDLE CurrentProcessId
Definition: misc.c:35
#define GdiHandleTable
Definition: win32nt.h:35
struct _GDIHANDLECACHE * PGDIHANDLECACHE
#define GetProcessHeap()
Definition: compat.h:395
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
PGDI_SHARED_HANDLE_TABLE GdiSharedHandleTable
Definition: misc.c:34
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
RTL_CRITICAL_SECTION semLocal
Definition: dllmain.c:12
PDEVCAPS GdiDevCaps
Definition: dllmain.c:9
HANDLE hProcessHeap
Definition: kbswitch.c:25

Referenced by ClientThreadSetupHelper(), and GdiDllInitialize().

◆ GetDllList()

BOOL GetDllList ( VOID  )

Definition at line 43 of file dllmain.c.

44 {
47  BOOL bRet = FALSE;
48  BOOL bLoad;
49  HANDLE hKey = NULL;
50  DWORD dwSize;
52 
53  UNICODE_STRING szKeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows");
54  UNICODE_STRING szLoadName = RTL_CONSTANT_STRING(L"LoadAppInit_DLLs");
55  UNICODE_STRING szDllsName = RTL_CONSTANT_STRING(L"AppInit_DLLs");
56 
58  Status = NtOpenKey(&hKey, KEY_READ, &Attributes);
59  if (NT_SUCCESS(Status))
60  {
61  dwSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(DWORD);
62  kvpInfo = HeapAlloc(GetProcessHeap(), 0, dwSize);
63  if (!kvpInfo)
64  goto end;
65 
66  Status = NtQueryValueKey(hKey,
67  &szLoadName,
69  kvpInfo,
70  dwSize,
71  &dwSize);
72  if (!NT_SUCCESS(Status))
73  goto end;
74 
75  RtlMoveMemory(&bLoad,
76  kvpInfo->Data,
77  kvpInfo->DataLength);
78 
79  HeapFree(GetProcessHeap(), 0, kvpInfo);
80  kvpInfo = NULL;
81 
82  if (bLoad)
83  {
84  Status = NtQueryValueKey(hKey,
85  &szDllsName,
87  NULL,
88  0,
89  &dwSize);
91  goto end;
92 
93  kvpInfo = HeapAlloc(GetProcessHeap(), 0, dwSize);
94  if (!kvpInfo)
95  goto end;
96 
97  Status = NtQueryValueKey(hKey,
98  &szDllsName,
100  kvpInfo,
101  dwSize,
102  &dwSize);
103  if (NT_SUCCESS(Status))
104  {
105  LPWSTR lpBuffer = (LPWSTR)kvpInfo->Data;
106  if (*lpBuffer != UNICODE_NULL)
107  {
108  INT bytesToCopy, nullPos;
109 
110  bytesToCopy = min(kvpInfo->DataLength, KEY_LENGTH * sizeof(WCHAR));
111 
112  if (bytesToCopy != 0)
113  {
115  kvpInfo->Data,
116  bytesToCopy);
117 
118  nullPos = (bytesToCopy / sizeof(WCHAR)) - 1;
119 
120  /* ensure string is terminated */
121  szAppInit[nullPos] = UNICODE_NULL;
122 
123  bRet = TRUE;
124  }
125  }
126  }
127  }
128  }
129 
130 end:
131  if (hKey)
132  NtClose(hKey);
133 
134  if (kvpInfo)
135  HeapFree(GetProcessHeap(), 0, kvpInfo);
136 
137  return bRet;
138 }
#define KEY_LENGTH
Definition: dllmain.c:24
#define TRUE
Definition: types.h:120
#define KEY_READ
Definition: nt_native.h:1023
LONG NTSTATUS
Definition: precomp.h:26
WCHAR szAppInit[KEY_LENGTH]
Definition: dllmain.c:40
GLuint GLuint end
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define min(a, b)
Definition: monoChain.cc:55
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by LoadAppInitDlls().

◆ Init()

BOOL Init ( PUSERCONNECT  UserCon)

Definition at line 385 of file dllmain.c.

386 {
388 
389  TRACE("user32::Init(0x%p) -->\n", UserCon);
390 
392 
393  /* Initialize callback table in PEB data */
394  NtCurrentPeb()->KernelCallbackTable = apfnDispatch;
395  NtCurrentPeb()->PostProcessInitRoutine = NULL;
396 
397  // This is a HACK!! //
401 
402  /*
403  * Retrieve data from the connect info structure if the initializing
404  * process is not CSRSS. In case it is, this will be done from inside
405  * ClientThreadSetup.
406  */
407  if (!gfServerProcess)
408  {
409  // FIXME: HACK!! We should fixup for the NtUserProcessConnect fixups
410  // because it was made in the context of CSRSS process and not ours!!
411  // So... as long as we don't fix that, we need to redo again a call
412  // to NtUserProcessConnect... How perverse is that?!
413  //
414  // HACK(2): This call is necessary since we disabled
415  // the CSR call in DllMain...
416  {
417  RtlZeroMemory(UserCon, sizeof(*UserCon));
418 
419  /* Minimal setup of the connect info structure */
420  UserCon->ulVersion = USER_VERSION;
421 
422  TRACE("HACK: Hackish NtUserProcessConnect call!!\n");
423  /* Connect to win32k */
425  UserCon,
426  sizeof(*UserCon));
427  if (!NT_SUCCESS(Status)) return FALSE;
428  }
429 
430  //
431  // We continue as we should do normally...
432  //
433 
434  /* Retrieve data */
435  g_ppi = GetWin32ClientInfo()->ppi; // Snapshot PI, used as pointer only!
437  gpsi = SharedPtrToUser(UserCon->siClient.psi);
440  gSharedInfo = UserCon->siClient;
441  }
442 
443  // FIXME: Yet another hack... This call should normally not be done here, but
444  // instead in ClientThreadSetup, and in User32CallClientThreadSetupFromKernel as well.
445  TRACE("HACK: Using Init-ClientThreadSetupHelper hack!!\n");
447  {
448  TRACE("Init-ClientThreadSetupHelper hack failed!\n");
449  return FALSE;
450  }
451 
452  TRACE("<-- user32::Init()\n");
453 
454  return NT_SUCCESS(Status);
455 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define USER_VERSION
Definition: ntuser.h:1098
#define GetWin32ClientInfo()
Definition: ntuser.h:320
PUSER_HANDLE_TABLE gHandleTable
Definition: dllmain.c:30
PUSER_HANDLE_ENTRY gHandleEntries
Definition: dllmain.c:31
PVOID apfnDispatch[USER32_CALLBACK_MAXIMUM+1]
Definition: dllmain.c:207
smooth NULL
Definition: ftsmooth.c:416
#define NtCurrentProcess()
Definition: nt_native.h:1657
PSERVERINFO psi
Definition: ntuser.h:1079
#define TRACE(s)
Definition: solgame.cpp:4
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG ulVersion
Definition: ntuser.h:1091
RTL_CRITICAL_SECTION gcsUserApiHook
Definition: usrapihk.c:39
BOOLEAN gfServerProcess
Definition: dllmain.c:36
ULONG_PTR ulSharedDelta
Definition: ntuser.h:1082
Status
Definition: gdiplustypes.h:24
#define NtCurrentPeb()
Definition: FLS.c:20
SHAREDINFO siClient
Definition: ntuser.h:1094
PUSER_HANDLE_ENTRY handles
Definition: ntuser.h:35
PPROCESSINFO g_ppi
Definition: dllmain.c:29
BOOL WINAPI ClientThreadSetupHelper(BOOL IsCallback)
Definition: dllmain.c:237
static __inline PVOID SharedPtrToUser(PVOID Ptr)
Definition: user_x.h:4
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
SHAREDINFO gSharedInfo
Definition: dllmain.c:33
BOOLEAN gfFirstThread
Definition: dllmain.c:37
return STATUS_SUCCESS
Definition: btrfs.c:2777
ULONG_PTR g_ulSharedDelta
Definition: dllmain.c:34
NTSTATUS NTAPI NtUserProcessConnect(IN HANDLE ProcessHandle, OUT PUSERCONNECT pUserConnect, IN ULONG Size)
Definition: ntstubs.c:529
PVOID aheList
Definition: ntuser.h:1080
PSERVERINFO gpsi
Definition: dllmain.c:32

Referenced by anonymous_namespace{mstscax.cpp}::CAdvancedSettings::CAdvancedSettings(), DllMain(), and TbdCreateToolbarWnd().

◆ LoadAppInitDlls()

VOID LoadAppInitDlls ( VOID  )

Definition at line 142 of file dllmain.c.

143 {
144  szAppInit[0] = UNICODE_NULL;
145 
146  if (GetDllList())
147  {
149  LPWSTR ptr;
150  size_t i;
151 
153 
154  for (i = 0; i < KEY_LENGTH; ++ i)
155  {
156  if(buffer[i] == L' ' || buffer[i] == L',')
157  buffer[i] = 0;
158  }
159 
160  for (i = 0; i < KEY_LENGTH; )
161  {
162  if(buffer[i] == 0)
163  ++ i;
164  else
165  {
166  ptr = buffer + i;
167  i += wcslen(ptr);
168  LoadLibraryW(ptr);
169  }
170  }
171  }
172 }
#define KEY_LENGTH
Definition: dllmain.c:24
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
WCHAR szAppInit[KEY_LENGTH]
Definition: dllmain.c:40
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UNICODE_NULL
static PVOID ptr
Definition: dispmode.c:27
#define LoadLibraryW(x)
Definition: compat.h:404
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
BOOL GetDllList(VOID)
Definition: dllmain.c:43
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by ClientThreadSetupHelper().

◆ UnloadAppInitDlls()

VOID UnloadAppInitDlls ( VOID  )

Definition at line 175 of file dllmain.c.

176 {
177  if (szAppInit[0] != UNICODE_NULL)
178  {
181  LPWSTR ptr;
182  size_t i;
183 
185 
186  for (i = 0; i < KEY_LENGTH; ++ i)
187  {
188  if(buffer[i] == L' ' || buffer[i] == L',')
189  buffer[i] = 0;
190  }
191 
192  for (i = 0; i < KEY_LENGTH; )
193  {
194  if(buffer[i] == 0)
195  ++ i;
196  else
197  {
198  ptr = buffer + i;
199  i += wcslen(ptr);
202  }
203  }
204  }
205 }
#define KEY_LENGTH
Definition: dllmain.c:24
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
WCHAR szAppInit[KEY_LENGTH]
Definition: dllmain.c:40
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define UNICODE_NULL
static PVOID ptr
Definition: dispmode.c:27
#define FreeLibrary(x)
Definition: compat.h:405
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:845
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HMODULE hModule
Definition: animate.c:44

Referenced by Cleanup().

◆ User32CallClientThreadSetupFromKernel()

NTSTATUS WINAPI User32CallClientThreadSetupFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 578 of file dllmain.c.

579 {
580  TRACE("User32CallClientThreadSetupFromKernel -->\n");
581  // FIXME: Disabling this call is a HACK!! See also ClientThreadSetup...
582  // ClientThreadSetupHelper(TRUE);
583  TRACE("<-- User32CallClientThreadSetupFromKernel\n");
585 }
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
return STATUS_SUCCESS
Definition: btrfs.c:2777

◆ User32CallGetCharsetInfo()

NTSTATUS WINAPI User32CallGetCharsetInfo ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 589 of file dllmain.c.

590 {
591  BOOL Ret;
592  PGET_CHARSET_INFO pgci = (PGET_CHARSET_INFO)Arguments;
593 
594  TRACE("GetCharsetInfo\n");
595 
596  Ret = TranslateCharsetInfo((DWORD *)(ULONG_PTR)pgci->Locale, &pgci->Cs, TCI_SRCLOCALE);
597 
598  return ZwCallbackReturn(Arguments, ArgumentLength, Ret ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
599 }
#define TCI_SRCLOCALE
Definition: wingdi.h:963
uint32_t ULONG_PTR
Definition: typedefs.h:63
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
CHARSETINFO Cs
Definition: callback.h:116
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI TranslateCharsetInfo(_Inout_ PDWORD, _Out_ LPCHARSETINFO, _In_ DWORD)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
struct _GET_CHARSET_INFO * PGET_CHARSET_INFO
return STATUS_SUCCESS
Definition: btrfs.c:2777

◆ User32CallLPKFromKernel()

NTSTATUS WINAPI User32CallLPKFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 664 of file dllmain.c.

665 {
666  BOOL bResult;
667  PLPK_CALLBACK_ARGUMENTS Argument;
668 
669  Argument = (PLPK_CALLBACK_ARGUMENTS)Arguments;
670 
671  Argument->lpString = (LPWSTR)((ULONG_PTR)Argument->lpString + (ULONG_PTR)Argument);
672 
673  bResult = ExtTextOutW(Argument->hdc,
674  Argument->x,
675  Argument->y,
676  Argument->flags,
677  (Argument->bRect) ? &Argument->rect : NULL,
678  Argument->lpString,
679  Argument->count,
680  NULL);
681 
682  return ZwCallbackReturn(&bResult, sizeof(BOOL), STATUS_SUCCESS);
683 }
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
uint32_t ULONG_PTR
Definition: typedefs.h:63
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define ULONG_PTR
Definition: config.h:101
struct _LPK_CALLBACK_ARGUMENTS * PLPK_CALLBACK_ARGUMENTS
WCHAR * LPWSTR
Definition: xmlstorage.h:184
return STATUS_SUCCESS
Definition: btrfs.c:2777

◆ User32CallOBMFromKernel()

NTSTATUS WINAPI User32CallOBMFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 632 of file dllmain.c.

633 {
634  BITMAP bmp;
635  PSETOBM_CALLBACK_ARGUMENTS Common = Arguments;
636 
638  Common->oembmi[OBI_CLOSE].cx = bmp.bmWidth;
639  Common->oembmi[OBI_CLOSE].cy = bmp.bmHeight;
640 
642  Common->oembmi[OBI_MNARROW].cx = bmp.bmWidth;
643  Common->oembmi[OBI_MNARROW].cy = bmp.bmHeight;
644 
646  Common->oembmi[OBI_DNARROW].cx = bmp.bmWidth;
647  Common->oembmi[OBI_DNARROW].cy = bmp.bmHeight;
648 
650  Common->oembmi[OBI_DNARROWI].cx = bmp.bmWidth;
651  Common->oembmi[OBI_DNARROWI].cy = bmp.bmHeight;
652 
654  Common->oembmi[OBI_UPARROW].cx = bmp.bmWidth;
655  Common->oembmi[OBI_UPARROW].cy = bmp.bmHeight;
656 
658  Common->oembmi[OBI_UPARROWI].cx = bmp.bmWidth;
659  Common->oembmi[OBI_UPARROWI].cy = bmp.bmHeight;
660 
661  return ZwCallbackReturn(Arguments, ArgumentLength, STATUS_SUCCESS);
662 }
#define OBM_DNARROW
Definition: winuser.h:1116
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
#define OBM_CLOSE
Definition: winuser.h:1118
BITMAP bmp
Definition: alphablend.c:62
#define OBM_UPARROWI
Definition: winuser.h:1101
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define OBM_MNARROW
Definition: winuser.h:1103
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2132
Definition: bl.h:1331
#define OBM_DNARROWI
Definition: winuser.h:1100
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
return STATUS_SUCCESS
Definition: btrfs.c:2777
struct tagOEMBITMAPINFO oembmi[93]
Definition: callback.h:141
#define OBM_UPARROW
Definition: winuser.h:1117

◆ User32CallSetWndIconsFromKernel()

NTSTATUS WINAPI User32CallSetWndIconsFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 603 of file dllmain.c.

604 {
605  PSETWNDICONS_CALLBACK_ARGUMENTS Common = Arguments;
606 
607  if (!gpsi->hIconSmWindows)
608  {
610  Common->hIconHand = LoadImageW(0, IDI_HAND, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
616  hIconWindows = Common->hIconWindows;
617  hIconSmWindows = Common->hIconSmWindows;
618  }
619  ERR("hIconSmWindows %p hIconWindows %p \n",hIconSmWindows,hIconWindows);
620  return ZwCallbackReturn(Arguments, ArgumentLength, STATUS_SUCCESS);
621 }
#define IMAGE_ICON
Definition: winuser.h:212
#define SM_CYSMICON
Definition: winuser.h:1003
#define IDI_APPLICATION
Definition: winuser.h:699
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
#define IDI_EXCLAMATION
Definition: winuser.h:702
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
HICON hIconWindows
Definition: dllmain.c:38
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
#define IDI_WINLOGO
Definition: winuser.h:704
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1002
#define ERR(fmt,...)
Definition: debug.h:109
#define IDI_QUESTION
Definition: winuser.h:701
HICON hIconSmWindows
Definition: dllmain.c:38
return STATUS_SUCCESS
Definition: btrfs.c:2777
#define IDI_ASTERISK
Definition: winuser.h:703
#define IDI_HAND
Definition: winuser.h:700
PSERVERINFO gpsi
Definition: dllmain.c:32

◆ User32CallUMPDFromKernel()

NTSTATUS WINAPI User32CallUMPDFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 685 of file dllmain.c.

686 {
688  INT cbSize = 0;
690  PUMPDPKTHEAD pkt, pktOut = NULL;
691 
692  pkt = (PUMPDPKTHEAD)Arguments;
693 
694  if ( pkt->RetSize <= sizeof(Buffer) )
695  {
696  pktOut = (PUMPDPKTHEAD)Buffer;
697 
698  if ( (GdiPrinterThunk( pkt, pktOut, pkt->RetSize ) == GDI_ERROR) )
699  {
700  pktOut = NULL;
702  }
703  else
704  {
705  cbSize = pkt->RetSize;
706  }
707  }
708  else
709  {
711  }
712  return ZwCallbackReturn( pktOut, cbSize, Status );
713 }
#define MAX_USER_MODE_DRV_BUFFER
Definition: dllmain.c:5
INT RetSize
Definition: dllmain.c:14
LONG NTSTATUS
Definition: precomp.h:26
int32_t INT
Definition: typedefs.h:56
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
INT WINAPI GdiPrinterThunk(PUMPDPKTHEAD, PVOID, INT)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Status
Definition: gdiplustypes.h:24
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
return STATUS_SUCCESS
Definition: btrfs.c:2777
#define GDI_ERROR
Definition: wingdi.h:1291
struct _UMPDPKTHEAD * PUMPDPKTHEAD

◆ User32DeliverUserAPC()

NTSTATUS WINAPI User32DeliverUserAPC ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 625 of file dllmain.c.

626 {
627  return ZwCallbackReturn(0, 0, STATUS_SUCCESS);
628 }
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
return STATUS_SUCCESS
Definition: btrfs.c:2777

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )

Variable Documentation

◆ apfnDispatch

PVOID apfnDispatch[USER32_CALLBACK_MAXIMUM+1]
Initial value:
=
{
}
NTSTATUS WINAPI User32CallDDEGetFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dde.c:288
NTSTATUS WINAPI User32CallSetWndIconsFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:603
NTSTATUS WINAPI User32CallCopyImageFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: cursoricon.c:1938
NTSTATUS WINAPI User32CallDDEPostFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dde.c:256
NTSTATUS WINAPI User32SetupDefaultCursors(PVOID Arguments, ULONG ArgumentLength)
Definition: cursoricon.c:48
NTSTATUS WINAPI User32CallClientThreadSetupFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:578
NTSTATUS WINAPI User32CallGetCharsetInfo(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:589
NTSTATUS WINAPI User32DeliverUserAPC(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:625
NTSTATUS WINAPI User32LoadSysMenuTemplateForKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: menu.c:655
NTSTATUS WINAPI User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: message.c:2926
NTSTATUS WINAPI User32CallLPKFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:664
NTSTATUS WINAPI User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: window.c:24
NTSTATUS WINAPI User32CallEventProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: hook.c:783
NTSTATUS WINAPI User32CallOBMFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:632
NTSTATUS WINAPI User32CallClientLoadLibraryFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: hook.c:528
NTSTATUS WINAPI User32CallUMPDFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:685
NTSTATUS WINAPI User32CallLoadMenuFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: menu.c:665
NTSTATUS WINAPI User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: hook.c:554

Definition at line 207 of file dllmain.c.

Referenced by Init().

◆ g_ppi

PPROCESSINFO g_ppi = NULL

Definition at line 29 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), Init(), and ValidateCallProc().

◆ g_ulSharedDelta

ULONG_PTR g_ulSharedDelta

Definition at line 34 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), Init(), and SharedPtrToUser().

◆ gfFirstThread

BOOLEAN gfFirstThread = TRUE

Definition at line 37 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), and Init().

◆ gfLogonProcess

BOOLEAN gfLogonProcess = FALSE

Definition at line 35 of file dllmain.c.

Referenced by RegisterLogonProcess().

◆ gfServerProcess

BOOLEAN gfServerProcess = FALSE

Definition at line 36 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), DllMain(), Init(), and LoadUserApiHook().

◆ gHandleEntries

PUSER_HANDLE_ENTRY gHandleEntries = NULL

Definition at line 31 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), GetUser32Handle(), and Init().

◆ gHandleTable

PUSER_HANDLE_TABLE gHandleTable = NULL

Definition at line 30 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), and Init().

◆ gpsi

PSERVERINFO gpsi = NULL

Definition at line 32 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), Init(), and User32CallSetWndIconsFromKernel().

◆ gSharedInfo

SHAREDINFO gSharedInfo = {0}

Definition at line 33 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), Init(), and User32InitializeImmEntryTable().

◆ hIconSmWindows

HICON hIconSmWindows = NULL

Definition at line 38 of file dllmain.c.

Referenced by User32CallSetWndIconsFromKernel().

◆ hIconWindows

HICON hIconWindows = NULL

Definition at line 38 of file dllmain.c.

Referenced by User32CallSetWndIconsFromKernel().

◆ szAppInit

WCHAR szAppInit[KEY_LENGTH]

Definition at line 40 of file dllmain.c.

Referenced by GetDllList(), LoadAppInitDlls(), and UnloadAppInitDlls().

◆ User32Instance

◆ User32TlsIndex

ULONG User32TlsIndex
static

Definition at line 26 of file dllmain.c.

Referenced by Cleanup(), and ClientThreadSetupHelper().