Author: hbelusca
Date: Thu Dec 18 00:30:27 2014
New Revision: 65714
URL:
http://svn.reactos.org/svn/reactos?rev=65714&view=rev
Log:
[WIN32K]
- Code formatting for NtUserProcessConnect.
[USER32]
- Hack a call to GetConnected in ClientThreadSetup in an attempt to temporarily
"fix" a bug that makes the bots fail. Now we really need to fix user32 init!
Modified:
trunk/reactos/include/reactos/subsys/win/base.h
trunk/reactos/win32ss/include/ntuser.h
trunk/reactos/win32ss/user/ntuser/ntstubs.c
trunk/reactos/win32ss/user/user32/misc/dllmain.c
Modified: trunk/reactos/include/reactos/subsys/win/base.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/win…
==============================================================================
--- trunk/reactos/include/reactos/subsys/win/base.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/subsys/win/base.h [iso-8859-1] Thu Dec 18 00:30:27 2014
@@ -13,7 +13,7 @@
typedef
BOOL
-(CALLBACK *BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(
+(NTAPI *BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(
HANDLE NewProcessId,
HANDLE ParentThreadId,
ULONG dwUnknown,
Modified: trunk/reactos/win32ss/include/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntuser.h?r…
==============================================================================
--- trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] Thu Dec 18 00:30:27 2014
@@ -2521,9 +2521,9 @@
NTAPI
NtUserNotifyProcessCreate(
HANDLE NewProcessId,
- HANDLE SourceThreadId,
- DWORD dwUnknown,
- ULONG CreateFlags);
+ HANDLE ParentThreadId,
+ ULONG dwUnknown,
+ ULONG CreateFlags);
VOID
NTAPI
Modified: trunk/reactos/win32ss/user/ntuser/ntstubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/ntstub…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] Thu Dec 18 00:30:27 2014
@@ -724,34 +724,43 @@
PUSERCONNECT pUserConnect,
DWORD Size)
{
- NTSTATUS Status = STATUS_SUCCESS;
- TRACE("NtUserProcessConnect\n");
- if (pUserConnect && ( Size == sizeof(USERCONNECT) ))
- {
- PPROCESSINFO W32Process;
- UserEnterShared();
- GetW32ThreadInfo();
- W32Process = PsGetCurrentProcessWin32Process();
- _SEH2_TRY
- {
+ NTSTATUS Status = STATUS_SUCCESS;
+ PPROCESSINFO W32Process;
+
+ TRACE("NtUserProcessConnect\n");
+
+ if ( pUserConnect == NULL ||
+ Size != sizeof(*pUserConnect) )
+ {
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ UserEnterShared();
+
+ W32Process = PsGetCurrentProcessWin32Process();
+ _SEH2_TRY
+ {
+ // FIXME: Check that pUserConnect->ulVersion == USER_VERSION;
+
pUserConnect->siClient.psi = gpsi;
pUserConnect->siClient.aheList = gHandleTable;
- pUserConnect->siClient.ulSharedDelta =
(ULONG_PTR)W32Process->HeapMappings.KernelMapping -
-
(ULONG_PTR)W32Process->HeapMappings.UserMapping;
- }
- _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
+ pUserConnect->siClient.ulSharedDelta =
+ (ULONG_PTR)W32Process->HeapMappings.KernelMapping -
+ (ULONG_PTR)W32Process->HeapMappings.UserMapping;
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
Status = _SEH2_GetExceptionCode();
- }
- _SEH2_END
- if (!NT_SUCCESS(Status))
- {
+ }
+ _SEH2_END;
+
+ if (!NT_SUCCESS(Status))
+ {
SetLastNtError(Status);
- }
- UserLeave();
- return Status;
- }
- return STATUS_UNSUCCESSFUL;
+ }
+
+ UserLeave();
+ return Status;
}
NTSTATUS
Modified: trunk/reactos/win32ss/user/user32/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/d…
==============================================================================
--- trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] Thu Dec 18 00:30:27
2014
@@ -240,6 +240,8 @@
// continue as normal.
//
+ GetConnected();
+
UNIMPLEMENTED;
return TRUE;
}
@@ -247,44 +249,53 @@
BOOL
Init(VOID)
{
- USERCONNECT UserCon;
-
- /* Set PEB data */
- NtCurrentPeb()->KernelCallbackTable = apfnDispatch;
- NtCurrentPeb()->PostProcessInitRoutine = NULL;
-
- NtUserProcessConnect( NtCurrentProcess(),
- &UserCon,
- sizeof(USERCONNECT));
-
- g_ppi = GetWin32ClientInfo()->ppi; // Snapshot PI, used as pointer only!
- g_ulSharedDelta = UserCon.siClient.ulSharedDelta;
- gpsi = SharedPtrToUser(UserCon.siClient.psi);
- gHandleTable = SharedPtrToUser(UserCon.siClient.aheList);
- gHandleEntries = SharedPtrToUser(gHandleTable->handles);
-
- RtlInitializeCriticalSection(&gcsUserApiHook);
-
- //ERR("1 SI 0x%x : HT 0x%x : D 0x%x\n", UserCon.siClient.psi,
UserCon.siClient.aheList, g_ulSharedDelta);
-
- /* Allocate an index for user32 thread local data. */
- User32TlsIndex = TlsAlloc();
- if (User32TlsIndex != TLS_OUT_OF_INDEXES)
- {
- if (MessageInit())
- {
- if (MenuInit())
- {
+ NTSTATUS Status;
+ USERCONNECT UserCon;
+
+ TRACE("user32::Init()\n");
+
+ /* Set PEB data */
+ NtCurrentPeb()->KernelCallbackTable = apfnDispatch;
+ NtCurrentPeb()->PostProcessInitRoutine = NULL;
+
+ /* Minimal setup of the connect info structure */
+ UserCon.ulVersion = USER_VERSION;
+
+ /* Connect to win32k */
+ Status = NtUserProcessConnect(NtCurrentProcess(),
+ &UserCon,
+ sizeof(UserCon));
+ if (!NT_SUCCESS(Status)) return FALSE;
+
+ /* Retrieve data */
+ g_ppi = GetWin32ClientInfo()->ppi; // Snapshot PI, used as pointer only!
+ g_ulSharedDelta = UserCon.siClient.ulSharedDelta;
+ gpsi = SharedPtrToUser(UserCon.siClient.psi);
+ gHandleTable = SharedPtrToUser(UserCon.siClient.aheList);
+ gHandleEntries = SharedPtrToUser(gHandleTable->handles);
+
+ RtlInitializeCriticalSection(&gcsUserApiHook);
+
+ //ERR("1 SI 0x%x : HT 0x%x : D 0x%x\n", UserCon.siClient.psi,
UserCon.siClient.aheList, g_ulSharedDelta);
+
+ /* Allocate an index for user32 thread local data */
+ User32TlsIndex = TlsAlloc();
+ if (User32TlsIndex == TLS_OUT_OF_INDEXES)
+ return FALSE;
+
+ if (MessageInit())
+ {
+ if (MenuInit())
+ {
InitializeCriticalSection(&U32AccelCacheLock);
LoadAppInitDlls();
return TRUE;
- }
- MessageCleanup();
- }
- TlsFree(User32TlsIndex);
- }
-
- return FALSE;
+ }
+ MessageCleanup();
+ }
+
+ TlsFree(User32TlsIndex);
+ return FALSE;
}
VOID
@@ -323,6 +334,9 @@
/* Don't bother us for each thread */
DisableThreadLibraryCalls(hInstanceDll);
+
+ /* Minimal setup of the connect info structure */
+ ConnectInfo.ulVersion = USER_VERSION;
/* Setup the Object Directory path */
if (!SessionId)
@@ -373,32 +387,40 @@
}
}
- /* Finally init GDI */
+ /* Finally, initialize GDI */
return GdiDllInitialize(hInstanceDll, dwReason, reserved);
}
-// FIXME: This function seems to be unused...
+// FIXME: This function IS A BIIG HACK!!
VOID
FASTCALL
GetConnected(VOID)
{
- USERCONNECT UserCon;
-
- if ((PTHREADINFO)NtCurrentTeb()->Win32ThreadInfo == NULL)
- NtUserGetThreadState(THREADSTATE_GETTHREADINFO);
-
- if (gpsi && g_ppi) return;
-
- NtUserProcessConnect( NtCurrentProcess(),
- &UserCon,
- sizeof(USERCONNECT));
-
- g_ppi = GetWin32ClientInfo()->ppi;
- g_ulSharedDelta = UserCon.siClient.ulSharedDelta;
- gpsi = SharedPtrToUser(UserCon.siClient.psi);
- gHandleTable = SharedPtrToUser(UserCon.siClient.aheList);
- gHandleEntries = SharedPtrToUser(gHandleTable->handles);
-
+ NTSTATUS Status;
+ USERCONNECT UserCon;
+
+ TRACE("user32::GetConnected()\n");
+
+ if ((PTHREADINFO)NtCurrentTeb()->Win32ThreadInfo == NULL)
+ NtUserGetThreadState(THREADSTATE_GETTHREADINFO);
+
+ if (gpsi && g_ppi) return;
+
+ /* Minimal setup of the connect info structure */
+ UserCon.ulVersion = USER_VERSION;
+
+ /* Connect to win32k */
+ Status = NtUserProcessConnect(NtCurrentProcess(),
+ &UserCon,
+ sizeof(UserCon));
+ if (!NT_SUCCESS(Status)) return;
+
+ /* Retrieve data */
+ g_ppi = GetWin32ClientInfo()->ppi; // Snapshot PI, used as pointer only!
+ g_ulSharedDelta = UserCon.siClient.ulSharedDelta;
+ gpsi = SharedPtrToUser(UserCon.siClient.psi);
+ gHandleTable = SharedPtrToUser(UserCon.siClient.aheList);
+ gHandleEntries = SharedPtrToUser(gHandleTable->handles);
}
NTSTATUS