[BASESRV]

- Introduce BaseClientConnectRoutine and BaseClientDisconnectRoutine functions that do basesrv (de)initialization, and BaseSrvNlsConnect that may potentially init further NLS support in the future.
- BaseSrvDebugProcess is deprecated in Windows 2k3+.
- Few whitespace fixes.
Piece of patch by Timo Kreuzer.
CORE-7505 #comment Basesrv (dis)connect routines committed in r65684.

svn path=/trunk/; revision=65684
This commit is contained in:
Hermès Bélusca-Maïto 2014-12-16 20:15:35 +00:00
parent db53788957
commit a4333d20f7
8 changed files with 65 additions and 27 deletions

View file

@ -13,7 +13,7 @@
typedef
BOOL
(CALLBACK * BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(
(CALLBACK *BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(
HANDLE NewProcessId,
HANDLE SourceThreadId,
DWORD dwUnknown,
@ -135,8 +135,6 @@ typedef struct _BASE_STATIC_SERVER_DATA
C_ASSERT(sizeof(BASE_STATIC_SERVER_DATA) == 0x1AC8);
#endif
VOID WINAPI BaseSrvNLSInit(IN PBASE_STATIC_SERVER_DATA StaticData);
#endif // _BASE_H
/* EOF */

View file

@ -22,7 +22,7 @@ typedef enum _BASESRV_API_NUMBER
BasepCreateThread,
BasepGetTempFile,
BasepExitProcess,
BasepDebugProcess,
BasepDebugProcess, // Deprecated
BasepCheckVDM,
BasepUpdateVDMEntry,
BasepGetNextVDMCommand,
@ -46,7 +46,7 @@ typedef enum _BASESRV_API_NUMBER
BasepNlsUpdateCacheCount,
BasepSetTermsrvClientTimeZone,
BasepSxsCreateActivationContext,
BasepUnknown,
BasepDebugProcessStop, // Alias to BasepDebugProcess, deprecated
BasepRegisterThread,
BasepNlsGetUserInfo,
@ -72,7 +72,7 @@ typedef struct _BASE_SXS_CREATEPROCESS_MSG
{
ULONG Flags;
ULONG ProcessParameterFlags;
HANDLE FileHandle;
HANDLE FileHandle;
UNICODE_STRING SxsWin32ExePath;
UNICODE_STRING SxsNtExePath;
SIZE_T OverrideManifestOffset;

View file

@ -29,7 +29,6 @@ CSR_API(BaseSrvRegisterThread);
CSR_API(BaseSrvSxsCreateActivationContext);
CSR_API(BaseSrvSetTermsrvAppInstallMode);
CSR_API(BaseSrvSetTermsrvClientTimeZone);
CSR_API(BaseSrvUnknown);
/* sndsntry.c */
CSR_API(BaseSrvSoundSentryNotification);
@ -49,6 +48,16 @@ CSR_API(BaseSrvRegisterWowExec);
CSR_API(BaseSrvRefreshIniFileMapping);
/* nls.c */
VOID
NTAPI
BaseSrvNLSInit(IN PBASE_STATIC_SERVER_DATA StaticData);
NTSTATUS
NTAPI
BaseSrvNlsConnect(IN PCSR_PROCESS CsrProcess,
IN OUT PVOID ConnectionInfo,
IN OUT PULONG ConnectionInfoLength);
CSR_API(BaseSrvNlsSetUserInfo);
CSR_API(BaseSrvNlsSetMultipleUserInfo);
CSR_API(BaseSrvNlsCreateSection);

View file

@ -61,7 +61,7 @@ PCSR_API_ROUTINE BaseServerApiDispatchTable[BasepMaxApiNumber - BASESRV_FIRST_AP
BaseSrvNlsUpdateCacheCount,
BaseSrvSetTermsrvClientTimeZone,
BaseSrvSxsCreateActivationContext,
BaseSrvUnknown,
BaseSrvDebugProcess,
BaseSrvRegisterThread,
BaseSrvNlsGetUserInfo,
};
@ -96,7 +96,7 @@ BOOLEAN BaseServerApiServerValidTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMB
TRUE, // BaseSrvNlsUpdateCacheCount
TRUE, // BaseSrvSetTermsrvClientTimeZone
TRUE, // BaseSrvSxsCreateActivationContext
TRUE, // BaseSrvUnknown
FALSE, // BaseSrvDebugProcess
TRUE, // BaseSrvRegisterThread
TRUE, // BaseSrvNlsGetUserInfo
};
@ -136,7 +136,7 @@ PCHAR BaseServerApiNameTable[BasepMaxApiNumber - BASESRV_FIRST_API_NUMBER] =
"BaseNlsUpdateCacheCount",
"BaseSetTermsrvClientTimeZone",
"BaseSxsCreateActivationContext",
"BaseUnknown",
"BaseSrvDebugProcessStop",
"BaseRegisterThread",
"BaseNlsGetUserInfo",
};
@ -570,12 +570,37 @@ BaseInitializeStaticServerData(IN PCSR_SERVER_DLL LoadedServerDll)
LoadedServerDll->SharedSection = BaseStaticServerData;
}
NTSTATUS
NTAPI
BaseClientConnectRoutine(IN PCSR_PROCESS CsrProcess,
IN OUT PVOID ConnectionInfo,
IN OUT PULONG ConnectionInfoLength)
{
PBASESRV_API_CONNECTINFO ConnectInfo = (PBASESRV_API_CONNECTINFO)ConnectionInfo;
if ( ConnectionInfo == NULL ||
ConnectionInfoLength == NULL ||
*ConnectionInfoLength != sizeof(*ConnectInfo) )
{
DPRINT1("BASESRV: Connection failed - ConnectionInfo = 0x%p ; ConnectionInfoLength = 0x%p (%lu), expected %lu\n",
ConnectionInfo,
ConnectionInfoLength,
ConnectionInfoLength ? *ConnectionInfoLength : (ULONG)-1,
sizeof(*ConnectInfo));
return STATUS_INVALID_PARAMETER;
}
/* Do the NLS connection */
return BaseSrvNlsConnect(CsrProcess, ConnectionInfo, ConnectionInfoLength);
}
VOID
NTAPI
BaseSrvDisconnect(PCSR_PROCESS Process)
BaseClientDisconnectRoutine(IN PCSR_PROCESS CsrProcess)
{
/* Cleanup the VDM console records */
BaseSrvCleanupVdmRecords(HandleToUlong(Process->ClientId.UniqueProcess));
BaseSrvCleanupVdmRecords(HandleToUlong(CsrProcess->ClientId.UniqueProcess));
}
CSR_SERVER_DLL_INIT(ServerDllInitialization)
@ -589,8 +614,8 @@ CSR_SERVER_DLL_INIT(ServerDllInitialization)
LoadedServerDll->NameTable = BaseServerApiNameTable;
#endif
LoadedServerDll->SizeOfProcessData = 0;
LoadedServerDll->ConnectCallback = NULL;
LoadedServerDll->DisconnectCallback = BaseSrvDisconnect;
LoadedServerDll->ConnectCallback = BaseClientConnectRoutine;
LoadedServerDll->DisconnectCallback = BaseClientDisconnectRoutine;
LoadedServerDll->ShutdownProcessCallback = NULL;
BaseSrvDllInstance = LoadedServerDll->ServerHandle;

View file

@ -108,7 +108,7 @@ BaseSrvDelayLoadKernel32(VOID)
}
VOID
WINAPI
NTAPI
BaseSrvNLSInit(IN PBASE_STATIC_SERVER_DATA StaticData)
{
/* Initialize the lock */
@ -130,6 +130,16 @@ BaseSrvNLSInit(IN PBASE_STATIC_SERVER_DATA StaticData)
NtQueryDefaultLocale(0, &pNlsRegUserInfo->UserLocaleId);
}
NTSTATUS
NTAPI
BaseSrvNlsConnect(IN PCSR_PROCESS CsrProcess,
IN OUT PVOID ConnectionInfo,
IN OUT PULONG ConnectionInfoLength)
{
/* Does nothing */
return STATUS_SUCCESS;
}
/* PUBLIC SERVER APIS *********************************************************/
CSR_API(BaseSrvNlsSetUserInfo)

View file

@ -18,8 +18,8 @@
CSR_API(BaseSrvDebugProcess)
{
DPRINT1("%s not yet implemented\n", __FUNCTION__);
return STATUS_NOT_IMPLEMENTED;
/* Deprecated */
return STATUS_UNSUCCESSFUL;
}
CSR_API(BaseSrvRegisterThread)
@ -27,6 +27,7 @@ CSR_API(BaseSrvRegisterThread)
DPRINT1("%s not yet implemented\n", __FUNCTION__);
return STATUS_NOT_IMPLEMENTED;
}
CSR_API(BaseSrvSxsCreateActivationContext)
{
DPRINT1("%s not yet implemented\n", __FUNCTION__);
@ -45,12 +46,6 @@ CSR_API(BaseSrvSetTermsrvClientTimeZone)
return STATUS_NOT_IMPLEMENTED;
}
CSR_API(BaseSrvUnknown)
{
DPRINT1("%s not yet implemented\n", __FUNCTION__);
return STATUS_NOT_IMPLEMENTED;
}
CSR_API(BaseSrvGetTempFile)
{
static UINT BaseGetTempFileUnique = 0;

View file

@ -15,7 +15,7 @@
/* GLOBALS ********************************************************************/
typedef BOOL (WINAPI *PUSER_SOUND_SENTRY)(VOID);
typedef BOOL (NTAPI *PUSER_SOUND_SENTRY)(VOID);
BOOL NTAPI FirstSoundSentry(VOID);
static PUSER_SOUND_SENTRY _UserSoundSentry = FirstSoundSentry;

View file

@ -420,11 +420,12 @@ ConSrvConnect(IN PCSR_PROCESS CsrProcess,
ConnectionInfoLength == NULL ||
*ConnectionInfoLength != sizeof(*ConnectInfo) )
{
DPRINT1("CONSRV: Connection failed - ConnectionInfo = 0x%p ; ConnectionInfoLength = 0x%p (%lu), wanted %lu\n",
DPRINT1("CONSRV: Connection failed - ConnectionInfo = 0x%p ; ConnectionInfoLength = 0x%p (%lu), expected %lu\n",
ConnectionInfo,
ConnectionInfoLength,
ConnectionInfoLength ? *ConnectionInfoLength : (ULONG)-1,
sizeof(*ConnectInfo));
return STATUS_UNSUCCESSFUL;
}
@ -500,9 +501,9 @@ ConSrvConnect(IN PCSR_PROCESS CsrProcess,
VOID
NTAPI
ConSrvDisconnect(PCSR_PROCESS Process)
ConSrvDisconnect(IN PCSR_PROCESS CsrProcess)
{
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(Process);
PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess);
/**************************************************************************
* This function is called whenever a new process (GUI or CUI) is destroyed.