ReactOS  0.4.15-dev-5122-g72bdbdd
dllmain.c File Reference
#include <user32.h>
#include <ndk/cmfuncs.h>
#include <strsafe.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)
 
NTSTATUS WINAPI User32CallImmProcessKeyFromKernel (PVOID Arguments, ULONG ArgumentLength)
 
NTSTATUS WINAPI User32CallImmLoadLayoutFromKernel (PVOID Arguments, ULONG ArgumentLength)
 

Variables

static ULONG User32TlsIndex
 
HINSTANCE User32Instance
 
PPROCESSINFO g_ppi = NULL
 
SHAREDINFO gSharedInfo = {0}
 
PSERVERINFO gpsi = NULL
 
PUSER_HANDLE_TABLE gHandleTable = NULL
 
PUSER_HANDLE_ENTRY gHandleEntries = NULL
 
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 459 of file dllmain.c.

460 {
463  MenuCleanup();
464  MessageCleanup();
467 }
CRITICAL_SECTION U32AccelCacheLock
Definition: accel.c:54
VOID UnloadAppInitDlls(VOID)
Definition: dllmain.c:174
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1166
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:3292
VOID MenuCleanup(VOID)
Definition: menu.c:649

Referenced by DllMain().

◆ ClientThreadSetup()

BOOL WINAPI ClientThreadSetup ( VOID  )

Definition at line 346 of file dllmain.c.

347 {
348  //
349  // This routine, in Windows, does a lot of what Init does, but in a radically
350  // different way.
351  //
352  // In Windows, because CSRSS's threads have TIF_CSRSSTHREAD set (we have this
353  // flag in ROS but not sure if we use it), the xxxClientThreadSetup callback
354  // isn't made when CSRSS first loads WINSRV.DLL (which loads USER32.DLL).
355  //
356  // However, all the other calls are made as normal, and WINSRV.DLL loads
357  // USER32.dll, the DllMain runs, and eventually the first NtUser system call is
358  // made which initializes Win32k (and initializes the thread, but as mentioned
359  // above, the thread is marked as TIF_CSRSSTHREAD).
360  //
361  // In the DllMain of User32, there is also a CsrClientConnectToServer call to
362  // server 2 (winsrv). When this is done from CSRSS, the "InServer" flag is set,
363  // so user32 will remember that it's running inside of CSRSS. Also, another
364  // flag, called "FirstThread" is manually set by DllMain.
365  //
366  // Then, WINSRV finishes loading, and CSRSRV starts the API thread/loop. This
367  // code then calls CsrConnectToUser, which calls... ClientThreadStartup. Now
368  // this routine detects that it's in the server process, which means it's CSRSS
369  // and that the callback never happened. It does some first-time-Win32k connection
370  // initialization and caches a bunch of things -- if it's the first thread. It also
371  // acquires a critical section to initialize GDI -- and then resets the first thread
372  // flag.
373  //
374  // For now, we'll do none of this, but to support Windows' CSRSRV.DLL which calls
375  // CsrConnectToUser, we'll pretend we "did something" here. Then the rest will
376  // continue as normal.
377  //
378 
379  // FIXME: Disabling this call is a HACK!! See also User32CallClientThreadSetupFromKernel...
380  // return ClientThreadSetupHelper(FALSE);
381  TRACE("ClientThreadSetup is not implemented\n");
382  return TRUE;
383 }
#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  // UserCon.dwDispatchCount;
275 
276  /* Connect to win32k */
278  &UserCon,
279  sizeof(UserCon));
280  if (!NT_SUCCESS(Status)) return FALSE;
281 
282  /* Retrieve data */
283  g_ppi = ClientInfo->ppi; // Snapshot PI, used as pointer only!
284  gSharedInfo = UserCon.siClient;
285  gpsi = gSharedInfo.psi;
287  /* ReactOS-Specific! */ gHandleEntries = SharedPtrToUser(gHandleTable->handles);
288 
289  // ERR("1 SI 0x%x : HT 0x%x : D 0x%x\n",
290  // gSharedInfo.psi, gSharedInfo.aheList, gSharedInfo.ulSharedDelta);
291  }
292 
293  TRACE("Checkpoint (register PFN)\n");
294  if (!RegisterClientPFN())
295  {
296  ERR("RegisterClientPFN failed\n");
297  return FALSE;
298  }
299 
300  /* Mark this thread as initialized */
301  ClientInfo->CI_flags |= CI_INITTHREAD;
302 
303  /* Initialization that should be done once per process */
304  if (IsFirstThread)
305  {
306  TRACE("Checkpoint (Allocating TLS)\n");
307 
308  /* Allocate an index for user32 thread local data */
311  return FALSE;
312 
313  // HAAAAAAAAAACK!!!!!!
314  // ASSERT(gpsi);
315  if (!gpsi) ERR("AAAAAAAAAAAHHHHHHHHHHHHHH!!!!!!!! gpsi == NULL !!!!\n");
316  if (gpsi)
317  {
318  TRACE("Checkpoint (MessageInit)\n");
319 
320  if (MessageInit())
321  {
322  TRACE("Checkpoint (MenuInit)\n");
323  if (MenuInit())
324  {
325  TRACE("Checkpoint initialization done OK\n");
327  LoadAppInitDlls();
328  return TRUE;
329  }
330  MessageCleanup();
331  }
332 
334  return FALSE;
335  }
336  }
337 
338  return TRUE;
339 }
signed char * PCHAR
Definition: retypes.h:7
BOOL MenuInit(VOID)
Definition: menu.c:359
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define USER_VERSION
Definition: ntuser.h:1116
#define GetWin32ClientInfo()
Definition: ntuser.h:335
PUSER_HANDLE_TABLE gHandleTable
Definition: dllmain.c:32
PUSER_HANDLE_ENTRY gHandleEntries
Definition: dllmain.c:33
char _InterlockedExchange8(_Interlocked_operand_ char volatile *_Target, char _Value)
CLIENT_DATA ClientInfo
#define CI_INITTHREAD
Definition: ntuser.h:294
VOID WINAPI GdiProcessSetup(VOID)
Definition: dllmain.c:42
#define FALSE
Definition: types.h:117
VOID LoadAppInitDlls(VOID)
Definition: dllmain.c:141
unsigned char BOOLEAN
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
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:1097
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG ulVersion
Definition: ntuser.h:1109
static ULONG User32TlsIndex
Definition: dllmain.c:26
BOOLEAN gfServerProcess
Definition: dllmain.c:35
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1100
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:546
VOID FASTCALL MessageCleanup(VOID)
Definition: message.c:3292
#define ERR(fmt,...)
Definition: debug.h:110
SHAREDINFO siClient
Definition: ntuser.h:1112
PUSER_HANDLE_ENTRY handles
Definition: ntuser.h:32
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:3284
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
SHAREDINFO gSharedInfo
Definition: dllmain.c:30
BOOLEAN gfFirstThread
Definition: dllmain.c:36
NTSTATUS NTAPI NtUserProcessConnect(IN HANDLE ProcessHandle, OUT PUSERCONNECT pUserConnect, IN ULONG Size)
Definition: ntstubs.c:476
PVOID aheList
Definition: ntuser.h:1098
PSERVERINFO gpsi
Definition: dllmain.c:31

Referenced by Init().

◆ DllMain()

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

Definition at line 470 of file dllmain.c.

474 {
475  switch (dwReason)
476  {
477  case DLL_PROCESS_ATTACH:
478  {
479 
480 #define WIN_OBJ_DIR L"\\Windows"
481 #define SESSION_DIR L"\\Sessions"
482 
483  USERSRV_API_CONNECTINFO ConnectInfo; // USERCONNECT
484 
485 #if 0 // Disabling this code is a BIG HACK!!
486 
488  ULONG ConnectInfoSize = sizeof(ConnectInfo);
489  WCHAR SessionDir[256];
490 
491  /* Cache the PEB and Session ID */
492  PPEB Peb = NtCurrentPeb();
493  ULONG SessionId = Peb->SessionId; // gSessionId
494 
495  TRACE("user32::DllMain\n");
496 
497  /* Don't bother us for each thread */
498  DisableThreadLibraryCalls(hInstanceDll);
499 
500  RtlZeroMemory(&ConnectInfo, sizeof(ConnectInfo));
501 
502  /* Minimal setup of the connect info structure */
503  ConnectInfo.ulVersion = USER_VERSION;
504 
505  /* Setup the Object Directory path */
506  if (!SessionId)
507  {
508  /* Use the raw path */
509  wcscpy(SessionDir, WIN_OBJ_DIR);
510  }
511  else
512  {
513  /* Use the session path */
514  swprintf(SessionDir,
515  L"%ws\\%ld%ws",
516  SESSION_DIR,
517  SessionId,
518  WIN_OBJ_DIR);
519  }
520 
521  TRACE("Checkpoint (call CSR)\n");
522 
523  /* Connect to the USER Server */
524  Status = CsrClientConnectToServer(SessionDir,
526  &ConnectInfo,
527  &ConnectInfoSize,
528  &gfServerProcess);
529  if (!NT_SUCCESS(Status))
530  {
531  ERR("Failed to connect to CSR (Status %lx)\n", Status);
532  return FALSE;
533  }
534 
535  TRACE("Checkpoint (CSR called)\n");
536 
537 #endif
538 
539  User32Instance = hInstanceDll;
540 
541  /* Finish initialization */
542  TRACE("Checkpoint (call Init)\n");
543  if (!Init(&ConnectInfo))
544  return FALSE;
545 
546  if (!gfServerProcess)
547  {
548  HINSTANCE hImm32 = NULL;
549 
550  if (gpsi && (gpsi->dwSRVIFlags & SRVINFO_IMM32))
551  {
552  WCHAR szImmFile[MAX_PATH];
554  User32GetImmFileName(szImmFile, _countof(szImmFile));
555  hImm32 = GetModuleHandleW(szImmFile);
556  }
557 
558  if (!IMM_FN(ImmRegisterClient)(&gSharedInfo, hImm32))
559  return FALSE;
560  }
561  break;
562  }
563 
564  case DLL_PROCESS_DETACH:
565  {
566  if (ghImm32)
568 
569  Cleanup();
570  break;
571  }
572  }
573 
574  /* Finally, initialize GDI */
575  return GdiDllInitialize(hInstanceDll, dwReason, reserved);
576 }
#define WIN_OBJ_DIR
PPEB Peb
Definition: dllmain.c:27
HINSTANCE ghImm32
Definition: imm.c:20
BOOL WINAPI InitializeImmEntryTable(VOID)
Definition: imm.c:119
#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:1116
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL Init(PUSERCONNECT UserCon)
Definition: dllmain.c:386
BOOL WINAPI ImmRegisterClient(PSHAREDINFO ptr, HINSTANCE hMod)
Definition: imm.c:44
HINSTANCE User32Instance
Definition: dllmain.c:27
DWORD dwReason
Definition: misc.cpp:154
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
DWORD dwSRVIFlags
Definition: ntuser.h:1022
r reserved
Definition: btrfs.c:3006
VOID Cleanup(VOID)
Definition: dllmain.c:459
#define SESSION_DIR
#define DLL_PROCESS_DETACH
Definition: compat.h:130
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:607
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define _countof(array)
Definition: sndvol32.h:68
#define USERSRV_API_CONNECTINFO
Definition: winmsg.h:40
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI GdiDllInitialize(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
Definition: dllmain.c:76
_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:1919
BOOLEAN gfServerProcess
Definition: dllmain.c:35
int _cdecl swprintf(const WCHAR *,...)
#define ERR(fmt,...)
Definition: debug.h:110
#define NtCurrentPeb()
Definition: FLS.c:22
#define NULL
Definition: types.h:112
#define SRVINFO_IMM32
Definition: ntuser.h:928
unsigned int ULONG
Definition: retypes.h:1
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
SHAREDINFO gSharedInfo
Definition: dllmain.c:30
HRESULT User32GetImmFileName(_Out_ LPWSTR lpBuffer, _In_ size_t cchBuffer)
Definition: imm.c:57
NTSTATUS NTAPI CsrClientConnectToServer(IN PWSTR ObjectDirectory, IN ULONG ServerId, IN PVOID ConnectionInfo, IN OUT PULONG ConnectionInfoSize, OUT PBOOLEAN ServerToServerCall)
Definition: connect.c:197
#define IMM_FN(name)
Definition: user32p.h:56
PSERVERINFO gpsi
Definition: dllmain.c:31

◆ GdiPrinterThunk()

INT WINAPI GdiPrinterThunk ( PUMPDPKTHEAD  ,
PVOID  ,
INT   
)

◆ GdiProcessSetup()

VOID WINAPI GdiProcessSetup ( VOID  )

Definition at line 42 of file dllmain.c.

43 {
44  if (!gbInitialized)
45  {
48 
49  /* map the gdi handle table to user space */
50  GdiHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
51  GdiSharedHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
53  CurrentProcessId = NtCurrentTeb()->ClientId.UniqueProcess;
54  GDI_BatchLimit = (DWORD) NtCurrentTeb()->ProcessEnvironmentBlock->GdiDCAttributeList;
55  GdiHandleCache = (PGDIHANDLECACHE)NtCurrentTeb()->ProcessEnvironmentBlock->GdiHandleBuffer;
59  }
60 }
DWORD GDI_BatchLimit
Definition: misc.c:36
#define TRUE
Definition: types.h:120
#define DWORD
Definition: nt_native.h:44
VOID WINAPI GdiInitializeLanguagePack(_In_ DWORD InitParam)
PGDIHANDLECACHE GdiHandleCache
Definition: dllmain.c:11
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
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:595
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
static BOOL gbInitialized
Definition: dllmain.c:7
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:13
PDEVCAPS GdiDevCaps
Definition: dllmain.c:10
HANDLE hProcessHeap
Definition: kbswitch.c:19

Referenced by ClientThreadSetupHelper(), and GdiDllInitialize().

◆ GetDllList()

BOOL GetDllList ( VOID  )

Definition at line 42 of file dllmain.c.

43 {
46  BOOL bRet = FALSE;
47  BOOL bLoad;
48  HANDLE hKey = NULL;
49  DWORD dwSize;
51 
52  UNICODE_STRING szKeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows");
53  UNICODE_STRING szLoadName = RTL_CONSTANT_STRING(L"LoadAppInit_DLLs");
54  UNICODE_STRING szDllsName = RTL_CONSTANT_STRING(L"AppInit_DLLs");
55 
58  if (NT_SUCCESS(Status))
59  {
60  dwSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(DWORD);
61  kvpInfo = HeapAlloc(GetProcessHeap(), 0, dwSize);
62  if (!kvpInfo)
63  goto end;
64 
66  &szLoadName,
68  kvpInfo,
69  dwSize,
70  &dwSize);
71  if (!NT_SUCCESS(Status))
72  goto end;
73 
74  RtlMoveMemory(&bLoad,
75  kvpInfo->Data,
76  kvpInfo->DataLength);
77 
78  HeapFree(GetProcessHeap(), 0, kvpInfo);
79  kvpInfo = NULL;
80 
81  if (bLoad)
82  {
84  &szDllsName,
86  NULL,
87  0,
88  &dwSize);
90  goto end;
91 
92  kvpInfo = HeapAlloc(GetProcessHeap(), 0, dwSize);
93  if (!kvpInfo)
94  goto end;
95 
97  &szDllsName,
99  kvpInfo,
100  dwSize,
101  &dwSize);
102  if (NT_SUCCESS(Status))
103  {
104  LPWSTR lpBuffer = (LPWSTR)kvpInfo->Data;
105  if (*lpBuffer != UNICODE_NULL)
106  {
107  INT bytesToCopy, nullPos;
108 
109  bytesToCopy = min(kvpInfo->DataLength, KEY_LENGTH * sizeof(WCHAR));
110 
111  if (bytesToCopy != 0)
112  {
114  kvpInfo->Data,
115  bytesToCopy);
116 
117  nullPos = (bytesToCopy / sizeof(WCHAR)) - 1;
118 
119  /* ensure string is terminated */
120  szAppInit[nullPos] = UNICODE_NULL;
121 
122  bRet = TRUE;
123  }
124  }
125  }
126  }
127  }
128 
129 end:
130  if (hKey)
131  NtClose(hKey);
132 
133  if (kvpInfo)
134  HeapFree(GetProcessHeap(), 0, kvpInfo);
135 
136  return bRet;
137 }
#define KEY_LENGTH
Definition: dllmain.c:24
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
WCHAR szAppInit[KEY_LENGTH]
Definition: dllmain.c:39
if(dx==0 &&dy==0)
Definition: linetemp.h:174
int32_t INT
Definition: typedefs.h:58
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
Status
Definition: gdiplustypes.h:24
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:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__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:3402
GLuint GLuint end
Definition: gl.h:1545
FxAutoRegKey hKey
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
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:594
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by LoadAppInitDlls().

◆ Init()

BOOL Init ( PUSERCONNECT  UserCon)

Definition at line 386 of file dllmain.c.

387 {
389 
390  TRACE("user32::Init(0x%p) -->\n", UserCon);
391 
393 
394  /* Initialize callback table in PEB data */
395  NtCurrentPeb()->KernelCallbackTable = apfnDispatch;
396  NtCurrentPeb()->PostProcessInitRoutine = NULL;
397 
398  // This is a HACK!! //
402 
403  /*
404  * Retrieve data from the connect info structure if the initializing
405  * process is not CSRSS. In case it is, this will be done from inside
406  * ClientThreadSetup.
407  */
408  if (!gfServerProcess)
409  {
410  // FIXME: HACK!! We should fixup for the NtUserProcessConnect fixups
411  // because it was made in the context of CSRSS process and not ours!!
412  // So... as long as we don't fix that, we need to redo again a call
413  // to NtUserProcessConnect... How perverse is that?!
414  //
415  // HACK(2): This call is necessary since we disabled
416  // the CSR call in DllMain...
417  {
418  RtlZeroMemory(UserCon, sizeof(*UserCon));
419 
420  /* Minimal setup of the connect info structure */
421  UserCon->ulVersion = USER_VERSION;
422  // UserCon->dwDispatchCount;
423 
424  TRACE("HACK: Hackish NtUserProcessConnect call!!\n");
425  /* Connect to win32k */
427  UserCon,
428  sizeof(*UserCon));
429  if (!NT_SUCCESS(Status)) return FALSE;
430  }
431 
432  //
433  // We continue as we should do normally...
434  //
435 
436  /* Retrieve data */
437  g_ppi = GetWin32ClientInfo()->ppi; // Snapshot PI, used as pointer only!
438  gSharedInfo = UserCon->siClient;
439  gpsi = gSharedInfo.psi;
441  /* ReactOS-Specific! */ gHandleEntries = SharedPtrToUser(gHandleTable->handles);
442  }
443 
444  // FIXME: Yet another hack... This call should normally not be done here, but
445  // instead in ClientThreadSetup, and in User32CallClientThreadSetupFromKernel as well.
446  TRACE("HACK: Using Init-ClientThreadSetupHelper hack!!\n");
448  {
449  TRACE("Init-ClientThreadSetupHelper hack failed!\n");
450  return FALSE;
451  }
452 
453  TRACE("<-- user32::Init()\n");
454 
455  return NT_SUCCESS(Status);
456 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define USER_VERSION
Definition: ntuser.h:1116
#define GetWin32ClientInfo()
Definition: ntuser.h:335
PUSER_HANDLE_TABLE gHandleTable
Definition: dllmain.c:32
PUSER_HANDLE_ENTRY gHandleEntries
Definition: dllmain.c:33
PVOID apfnDispatch[USER32_CALLBACK_MAXIMUM+1]
Definition: dllmain.c:206
#define FALSE
Definition: types.h:117
#define NtCurrentProcess()
Definition: nt_native.h:1657
PSERVERINFO psi
Definition: ntuser.h:1097
Status
Definition: gdiplustypes.h:24
#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:1109
RTL_CRITICAL_SECTION gcsUserApiHook
Definition: usrapihk.c:39
BOOLEAN gfServerProcess
Definition: dllmain.c:35
#define NtCurrentPeb()
Definition: FLS.c:22
SHAREDINFO siClient
Definition: ntuser.h:1112
PUSER_HANDLE_ENTRY handles
Definition: ntuser.h:32
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 NULL
Definition: types.h:112
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
SHAREDINFO gSharedInfo
Definition: dllmain.c:30
#define STATUS_SUCCESS
Definition: shellext.h:65
BOOLEAN gfFirstThread
Definition: dllmain.c:36
NTSTATUS NTAPI NtUserProcessConnect(IN HANDLE ProcessHandle, OUT PUSERCONNECT pUserConnect, IN ULONG Size)
Definition: ntstubs.c:476
PVOID aheList
Definition: ntuser.h:1098
PSERVERINFO gpsi
Definition: dllmain.c:31

Referenced by anonymous_namespace{mstscax.cpp}::CAdvancedSettings::CAdvancedSettings(), DllMain(), CFontExtModule::Init(), and STDMETHODIMP_().

◆ LoadAppInitDlls()

VOID LoadAppInitDlls ( VOID  )

Definition at line 141 of file dllmain.c.

142 {
143  szAppInit[0] = UNICODE_NULL;
144 
145  if (GetDllList())
146  {
148  LPWSTR ptr;
149  size_t i;
150 
152 
153  for (i = 0; i < KEY_LENGTH; ++ i)
154  {
155  if(buffer[i] == L' ' || buffer[i] == L',')
156  buffer[i] = 0;
157  }
158 
159  for (i = 0; i < KEY_LENGTH; )
160  {
161  if(buffer[i] == 0)
162  ++ i;
163  else
164  {
165  ptr = buffer + i;
166  i += wcslen(ptr);
167  LoadLibraryW(ptr);
168  }
169  }
170  }
171 }
#define KEY_LENGTH
Definition: dllmain.c:24
WCHAR szAppInit[KEY_LENGTH]
Definition: dllmain.c:39
GLuint buffer
Definition: glext.h:5915
#define L(x)
Definition: ntvdm.h:50
#define UNICODE_NULL
static PVOID ptr
Definition: dispmode.c:27
#define LoadLibraryW(x)
Definition: compat.h:606
__wchar_t WCHAR
Definition: xmlstorage.h:180
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
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
BOOL GetDllList(VOID)
Definition: dllmain.c:42
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by ClientThreadSetupHelper().

◆ UnloadAppInitDlls()

VOID UnloadAppInitDlls ( VOID  )

Definition at line 174 of file dllmain.c.

175 {
176  if (szAppInit[0] != UNICODE_NULL)
177  {
180  LPWSTR ptr;
181  size_t i;
182 
184 
185  for (i = 0; i < KEY_LENGTH; ++ i)
186  {
187  if(buffer[i] == L' ' || buffer[i] == L',')
188  buffer[i] = 0;
189  }
190 
191  for (i = 0; i < KEY_LENGTH; )
192  {
193  if(buffer[i] == 0)
194  ++ i;
195  else
196  {
197  ptr = buffer + i;
198  i += wcslen(ptr);
201  }
202  }
203  }
204 }
#define KEY_LENGTH
Definition: dllmain.c:24
WCHAR szAppInit[KEY_LENGTH]
Definition: dllmain.c:39
GLuint buffer
Definition: glext.h:5915
#define L(x)
Definition: ntvdm.h:50
#define UNICODE_NULL
static PVOID ptr
Definition: dispmode.c:27
#define FreeLibrary(x)
Definition: compat.h:607
__wchar_t WCHAR
Definition: xmlstorage.h:180
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
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HMODULE hModule
Definition: animate.c:44

Referenced by Cleanup().

◆ User32CallClientThreadSetupFromKernel()

NTSTATUS WINAPI User32CallClientThreadSetupFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 580 of file dllmain.c.

581 {
582  TRACE("User32CallClientThreadSetupFromKernel -->\n");
583  // FIXME: Disabling this call is a HACK!! See also ClientThreadSetup...
584  // ClientThreadSetupHelper(TRUE);
585  TRACE("<-- User32CallClientThreadSetupFromKernel\n");
587 }
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ User32CallGetCharsetInfo()

NTSTATUS WINAPI User32CallGetCharsetInfo ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 591 of file dllmain.c.

592 {
593  BOOL Ret;
594  PGET_CHARSET_INFO pgci = (PGET_CHARSET_INFO)Arguments;
595 
596  TRACE("GetCharsetInfo\n");
597 
598  Ret = TranslateCharsetInfo((DWORD *)(ULONG_PTR)pgci->Locale, &pgci->Cs, TCI_SRCLOCALE);
599 
600  return ZwCallbackReturn(Arguments, ArgumentLength, Ret ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
601 }
#define TCI_SRCLOCALE
Definition: wingdi.h:964
uint32_t ULONG_PTR
Definition: typedefs.h:65
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
CHARSETINFO Cs
Definition: callback.h:133
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
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ User32CallImmLoadLayoutFromKernel()

NTSTATUS WINAPI User32CallImmLoadLayoutFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 731 of file dllmain.c.

732 {
733  PIMMLOADLAYOUT_CALLBACK_ARGUMENTS Common = Arguments;
735  Result.ret = IMM_FN(ImmLoadLayout)(Common->hKL, &Result.iiex);
736  return ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS);
737 }
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define STATUS_SUCCESS
Definition: shellext.h:65
BOOL WINAPI ImmLoadLayout(HKL hKL, PIMEINFOEX pImeInfoEx)
Definition: imm.c:54
#define IMM_FN(name)
Definition: user32p.h:56

◆ User32CallImmProcessKeyFromKernel()

NTSTATUS WINAPI User32CallImmProcessKeyFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 718 of file dllmain.c.

719 {
720  PIMMPROCESSKEY_CALLBACK_ARGUMENTS Common = Arguments;
721  DWORD Result = IMM_FN(ImmProcessKey)(Common->hWnd,
722  Common->hKL,
723  Common->vKey,
724  Common->lParam,
725  Common->dwHotKeyID);
726 
727  return ZwCallbackReturn(&Result, sizeof(DWORD), STATUS_SUCCESS);
728 }
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
DWORD WINAPI ImmProcessKey(HWND hWnd, HKL hKL, UINT vKey, LPARAM lParam, DWORD dwHotKeyID)
Definition: keymsg.c:690
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IMM_FN(name)
Definition: user32p.h:56

◆ User32CallLPKFromKernel()

NTSTATUS WINAPI User32CallLPKFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 666 of file dllmain.c.

667 {
668  BOOL bResult;
669  PLPK_CALLBACK_ARGUMENTS Argument;
670 
671  Argument = (PLPK_CALLBACK_ARGUMENTS)Arguments;
672 
673  Argument->lpString = (LPWSTR)((ULONG_PTR)Argument->lpString + (ULONG_PTR)Argument);
674 
675  bResult = ExtTextOutW(Argument->hdc,
676  Argument->x,
677  Argument->y,
678  Argument->flags,
679  (Argument->bRect) ? &Argument->rect : NULL,
680  Argument->lpString,
681  Argument->count,
682  NULL);
683 
684  return ZwCallbackReturn(&bResult, sizeof(BOOL), STATUS_SUCCESS);
685 }
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:65
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define NULL
Definition: types.h:112
#define ULONG_PTR
Definition: config.h:101
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _LPK_CALLBACK_ARGUMENTS * PLPK_CALLBACK_ARGUMENTS
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ User32CallOBMFromKernel()

NTSTATUS WINAPI User32CallOBMFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 634 of file dllmain.c.

635 {
636  BITMAP bmp;
637  PSETOBM_CALLBACK_ARGUMENTS Common = Arguments;
638 
640  Common->oembmi[OBI_CLOSE].cx = bmp.bmWidth;
641  Common->oembmi[OBI_CLOSE].cy = bmp.bmHeight;
642 
644  Common->oembmi[OBI_MNARROW].cx = bmp.bmWidth;
645  Common->oembmi[OBI_MNARROW].cy = bmp.bmHeight;
646 
648  Common->oembmi[OBI_DNARROW].cx = bmp.bmWidth;
649  Common->oembmi[OBI_DNARROW].cy = bmp.bmHeight;
650 
652  Common->oembmi[OBI_DNARROWI].cx = bmp.bmWidth;
653  Common->oembmi[OBI_DNARROWI].cy = bmp.bmHeight;
654 
656  Common->oembmi[OBI_UPARROW].cx = bmp.bmWidth;
657  Common->oembmi[OBI_UPARROW].cy = bmp.bmHeight;
658 
660  Common->oembmi[OBI_UPARROWI].cx = bmp.bmWidth;
661  Common->oembmi[OBI_UPARROWI].cy = bmp.bmHeight;
662 
663  return ZwCallbackReturn(Arguments, ArgumentLength, STATUS_SUCCESS);
664 }
#define OBM_DNARROW
Definition: winuser.h:1120
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
#define OBM_CLOSE
Definition: winuser.h:1122
BITMAP bmp
Definition: alphablend.c:62
#define OBM_UPARROWI
Definition: winuser.h:1105
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define OBM_MNARROW
Definition: winuser.h:1107
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2132
Definition: bl.h:1330
#define OBM_DNARROWI
Definition: winuser.h:1104
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define STATUS_SUCCESS
Definition: shellext.h:65
struct tagOEMBITMAPINFO oembmi[93]
Definition: callback.h:158
#define OBM_UPARROW
Definition: winuser.h:1121

◆ User32CallSetWndIconsFromKernel()

NTSTATUS WINAPI User32CallSetWndIconsFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 605 of file dllmain.c.

606 {
607  PSETWNDICONS_CALLBACK_ARGUMENTS Common = Arguments;
608 
609  if (!gpsi->hIconSmWindows)
610  {
612  Common->hIconHand = LoadImageW(0, IDI_HAND, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
618  hIconWindows = Common->hIconWindows;
619  hIconSmWindows = Common->hIconSmWindows;
620  }
621  ERR("hIconSmWindows %p hIconWindows %p \n",hIconSmWindows,hIconWindows);
622  return ZwCallbackReturn(Arguments, ArgumentLength, STATUS_SUCCESS);
623 }
#define IMAGE_ICON
Definition: winuser.h:212
#define SM_CYSMICON
Definition: winuser.h:1007
#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:37
#define LR_DEFAULTSIZE
Definition: winuser.h:1088
#define IDI_WINLOGO
Definition: winuser.h:704
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1006
#define ERR(fmt,...)
Definition: debug.h:110
#define IDI_QUESTION
Definition: winuser.h:701
#define STATUS_SUCCESS
Definition: shellext.h:65
HICON hIconSmWindows
Definition: dllmain.c:37
#define IDI_ASTERISK
Definition: winuser.h:703
#define IDI_HAND
Definition: winuser.h:700
PSERVERINFO gpsi
Definition: dllmain.c:31

◆ User32CallUMPDFromKernel()

NTSTATUS WINAPI User32CallUMPDFromKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 687 of file dllmain.c.

688 {
690  INT cbSize = 0;
692  PUMPDPKTHEAD pkt, pktOut = NULL;
693 
694  pkt = (PUMPDPKTHEAD)Arguments;
695 
696  if ( pkt->RetSize <= sizeof(Buffer) )
697  {
698  pktOut = (PUMPDPKTHEAD)Buffer;
699 
700  if ( (GdiPrinterThunk( pkt, pktOut, pkt->RetSize ) == GDI_ERROR) )
701  {
702  pktOut = NULL;
704  }
705  else
706  {
707  cbSize = pkt->RetSize;
708  }
709  }
710  else
711  {
713  }
714  return ZwCallbackReturn( pktOut, cbSize, Status );
715 }
#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:58
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
Definition: bufpool.h:45
INT WINAPI GdiPrinterThunk(PUMPDPKTHEAD, PVOID, INT)
Status
Definition: gdiplustypes.h:24
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
#define GDI_ERROR
Definition: wingdi.h:1309
struct _UMPDPKTHEAD * PUMPDPKTHEAD

◆ User32DeliverUserAPC()

NTSTATUS WINAPI User32DeliverUserAPC ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 627 of file dllmain.c.

628 {
629  return ZwCallbackReturn(0, 0, STATUS_SUCCESS);
630 }
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ 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:605
NTSTATUS WINAPI User32CallImmLoadLayoutFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:731
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:580
NTSTATUS WINAPI User32CallGetCharsetInfo(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:591
NTSTATUS WINAPI User32DeliverUserAPC(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:627
NTSTATUS WINAPI User32LoadSysMenuTemplateForKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: menu.c:655
NTSTATUS WINAPI User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: message.c:2937
NTSTATUS WINAPI User32CallLPKFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:666
NTSTATUS WINAPI User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: window.c:24
NTSTATUS WINAPI User32CallImmProcessKeyFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:718
NTSTATUS WINAPI User32CallEventProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: hook.c:796
NTSTATUS WINAPI User32CallOBMFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:634
NTSTATUS WINAPI User32CallClientLoadLibraryFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: hook.c:528
NTSTATUS WINAPI User32CallUMPDFromKernel(PVOID Arguments, ULONG ArgumentLength)
Definition: dllmain.c:687
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 206 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().

◆ gfFirstThread

BOOLEAN gfFirstThread = TRUE

Definition at line 36 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), and Init().

◆ gfLogonProcess

BOOLEAN gfLogonProcess = FALSE

Definition at line 34 of file dllmain.c.

Referenced by RegisterLogonProcess().

◆ gfServerProcess

BOOLEAN gfServerProcess = FALSE

Definition at line 35 of file dllmain.c.

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

◆ gHandleEntries

PUSER_HANDLE_ENTRY gHandleEntries = NULL

Definition at line 33 of file dllmain.c.

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

◆ gHandleTable

PUSER_HANDLE_TABLE gHandleTable = NULL

Definition at line 32 of file dllmain.c.

Referenced by ClientThreadSetupHelper(), and Init().

◆ gpsi

PSERVERINFO gpsi = NULL

Definition at line 31 of file dllmain.c.

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

◆ gSharedInfo

SHAREDINFO gSharedInfo = {0}

Definition at line 30 of file dllmain.c.

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

◆ hIconSmWindows

HICON hIconSmWindows = NULL

Definition at line 37 of file dllmain.c.

Referenced by User32CallSetWndIconsFromKernel().

◆ hIconWindows

HICON hIconWindows = NULL

Definition at line 37 of file dllmain.c.

Referenced by User32CallSetWndIconsFromKernel().

◆ szAppInit

WCHAR szAppInit[KEY_LENGTH]

Definition at line 39 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().