Skip to content

Commit

Permalink
Update ntext_wrapper, advapi32_wrapper and setupapi_wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Skulltrail192 committed Aug 4, 2023
1 parent 116b78d commit b04e057
Show file tree
Hide file tree
Showing 22 changed files with 4,255 additions and 117 deletions.
46 changes: 45 additions & 1 deletion dll/ntdll/def/ntdll.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1451,4 +1451,48 @@
@ stdcall -arch=x86_64 RtlLookupFunctionTable(int64 ptr ptr)
@ stdcall -stub -arch=x86_64 RtlCopyMemoryNonTemporal(ptr ptr long)
@ stdcall -stub -arch=x86_64 RtlGetFunctionTableListHead()
@ cdecl -stub -arch=x86_64 __misaligned_access()
@ cdecl -stub -arch=x86_64 __misaligned_access()

#Vista only support Functions
@ stdcall -stub CsrVerifyRegion()
@ stdcall -stub LdrGetFileNameFromLoadAsDataTable()
@ stdcall -stub LdrRemoveLoadAsDataTable()
@ stdcall -stub LdrResFindResource()
@ stdcall -stub LdrResFindResourceDirectory()
@ stdcall -stub LdrResSearchResource()
@ stdcall -stub LdrpResGetMappingSize()
@ stdcall -stub LdrpResGetRCConfig()
@ stdcall -stub LdrpResGetResourceDirectory()
@ stdcall -stub NtCancelSynchronousIoFile()
@ stdcall -stub NtCreateUserProcess()
@ stdcall -stub NtInitializeNlsFiles()
@ stdcall -stub RtlCleanUpTEBLangLists()
@ stdcall -stub RtlCreateEnvironmentEx()
@ stdcall -stub RtlCreateProcessParametersEx()
@ stdcall -stub RtlExitUserProcess()
@ stdcall -stub RtlExpandEnvironmentStrings()
@ stdcall -stub RtlInitializeCriticalSectionEx()
@ stdcall -stub RtlInitializeExceptionChain()
@ stdcall -stub RtlLocaleNameToLcid()
@ stdcall -stub RtlQueryElevationFlags()
@ stdcall -stub RtlQueryEnvironmentVariable()
@ stdcall -stub RtlSetEnvironmentVar()
@ stdcall -stub RtlTryAcquirePebLock()
@ stdcall -stub RtlWerpReportException()
@ stdcall -stub RtlpCheckDynamicTimeZoneInformation()
@ stdcall -stub RtlpConvertCultureNamesToLCIDs()
@ stdcall -stub RtlpConvertLCIDsToCultureNames()
@ stdcall -stub RtlpCreateProcessRegistryInfo()
@ stdcall -stub RtlpGetLCIDFromLangInfoNode()
@ stdcall -stub RtlpGetNameFromLangInfoNode()
@ stdcall -stub RtlpGetSystemDefaultUILanguage()
@ stdcall -stub RtlpInitializeLangRegistryInfo()
@ stdcall -stub RtlpIsQualifiedLanguage()
@ stdcall -stub RtlpLoadMachineUIByPolicy()
@ stdcall -stub RtlpLoadUserUIByPolicy()
@ stdcall -stub RtlpMuiFreeLangRegistryInfo()
@ stdcall -stub TpCaptureCaller()
@ stdcall -stub TpCheckTerminateWorker()
@ stdcall -stub WerCheckEventEscalation()
@ stdcall -stub WerReportSQMEvent()
@ stdcall -stub WerReportWatsonEvent()
2 changes: 1 addition & 1 deletion sdk/include/reactos/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ string(TIMESTAMP KERNEL_VERSION_BUILD %Y%m%d UTC)
set(KERNEL_VERSION_MAJOR "0")
set(KERNEL_VERSION_MINOR "4")
set(KERNEL_VERSION_PATCH_LEVEL "14")
set(COPYRIGHT_YEAR "2021")
set(COPYRIGHT_YEAR "2023")

# KERNEL_VERSION_BUILD_TYPE is "dev" for Git builds
# or "RC1", "RC2", "" for releases.
Expand Down
47 changes: 47 additions & 0 deletions wrappers/base/advapi32_wrapper/logon32.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*++
Copyright (c) 2023 Shorthorn Project
Module Name:
logon32.c
Abstract:
Logon relative functions
Author:
Skulltrail 24-Febraury-2023
Revision History:
--*/

#include "main.h"

BOOL WINAPI LogonUserExExW(
_In_ LPWSTR lpszUsername,
_In_opt_ LPWSTR lpszDomain,
_In_opt_ LPWSTR lpszPassword,
_In_ DWORD dwLogonType,
_In_ DWORD dwLogonProvider,
_In_opt_ PTOKEN_GROUPS pTokenGroups,
_Out_opt_ PHANDLE phToken,
_Out_opt_ PSID *ppLogonSid,
_Out_opt_ PVOID *ppProfileBuffer,
_Out_opt_ LPDWORD pdwProfileLength,
_Out_opt_ PQUOTA_LIMITS pQuotaLimits
)
{
return LogonUserExW(lpszUsername,
lpszDomain,
lpszPassword,
dwLogonType,
dwLogonProvider,
phToken,
ppLogonSid,
ppProfileBuffer,
pdwProfileLength,
pQuotaLimits);
}
146 changes: 91 additions & 55 deletions wrappers/base/kernelbase_wrapper/synch.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,65 +752,101 @@ BOOL getQueuedCompletionStatus(
&lpEnt->lpOverlapped, dwMilliseconds);
}

BOOL
WINAPI
GetQueuedCompletionStatusEx(
HANDLE CompletionPort,
LPOVERLAPPED_ENTRY lpCompletionPortEntries,
ULONG ulCount,
PULONG ulNumEntriesRemoved,
DWORD dwMilliseconds,
BOOL fAlertable
)
{
int i = 0;
LPOVERLAPPED_ENTRY currentEntry;
NTSTATUS status;
DWORD ret;
LARGE_INTEGER TimeOut;
PLARGE_INTEGER pTimeOut;
// BOOL
// WINAPI
// GetQueuedCompletionStatusEx(
// HANDLE CompletionPort,
// LPOVERLAPPED_ENTRY lpCompletionPortEntries,
// ULONG ulCount,
// PULONG ulNumEntriesRemoved,
// DWORD dwMilliseconds,
// BOOL fAlertable
// )
// {
// int i = 0;
// LPOVERLAPPED_ENTRY currentEntry;
// NTSTATUS status;
// DWORD ret;
// LARGE_INTEGER TimeOut;
// PLARGE_INTEGER pTimeOut;

pTimeOut = BaseFormatTimeOut(&TimeOut, dwMilliseconds);
// pTimeOut = BaseFormatTimeOut(&TimeOut, dwMilliseconds);

// validate arguments
if(!lpCompletionPortEntries
|| !ulCount || !ulNumEntriesRemoved) {
RtlSetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE; }
// // validate arguments
// if(!lpCompletionPortEntries
// || !ulCount || !ulNumEntriesRemoved) {
// RtlSetLastWin32Error(ERROR_INVALID_PARAMETER);
// return FALSE; }

//DbgPrint("GetQueuedCompletionStatusEx: fAlertable");
// //DbgPrint("GetQueuedCompletionStatusEx: fAlertable");

// retrieve multiple entries
for(i = 0;i < ulCount; i++)
{
currentEntry = lpCompletionPortEntries+i;
status = currentEntry->Internal;
if (status == STATUS_PENDING)
{
if (!dwMilliseconds)
{
SetLastError( ERROR_IO_INCOMPLETE );
return FALSE;
}
ret = WaitForSingleObjectEx( currentEntry->lpOverlapped->hEvent ? currentEntry->lpOverlapped->hEvent : CompletionPort, dwMilliseconds, fAlertable );
if (ret == WAIT_FAILED)
return FALSE;
else if (ret)
{
SetLastError( ret );
return FALSE;
}

status = currentEntry->Internal;
//if (status == STATUS_PENDING) status = STATUS_SUCCESS;
if (status != WAIT_OBJECT_0) break;
}
if(!getQueuedCompletionStatus(CompletionPort,
currentEntry, dwMilliseconds)) break;
dwMilliseconds = 0;
}
// // retrieve multiple entries
// for(i = 0;i < ulCount; i++)
// {
// currentEntry = lpCompletionPortEntries+i;
// status = currentEntry->Internal;
// if (status == STATUS_PENDING)
// {
// if (!dwMilliseconds)
// {
// SetLastError( ERROR_IO_INCOMPLETE );
// return FALSE;
// }
// ret = WaitForSingleObjectEx( currentEntry->lpOverlapped->hEvent ? currentEntry->lpOverlapped->hEvent : CompletionPort, dwMilliseconds, fAlertable );
// if (ret == WAIT_FAILED)
// return FALSE;
// else if (ret)
// {
// SetLastError( ret );
// return FALSE;
// }

// status = currentEntry->Internal;
// //if (status == STATUS_PENDING) status = STATUS_SUCCESS;
// if (status != WAIT_OBJECT_0) break;
// }
// if(!getQueuedCompletionStatus(CompletionPort,
// currentEntry, dwMilliseconds)) break;
// dwMilliseconds = 0;
// }

// *ulNumEntriesRemoved = i;

// return TRUE;
// }

BOOL GetQueuedCompletionStatusEx(HANDLE CompletionPort, LPOVERLAPPED_ENTRY lpCompletionPortEntries,
ULONG ulCount, PULONG ulNumEntriesRemoved, DWORD dwMilliseconds)
{
ULONG numEntriesRemoved = 0;
DWORD startTime = GetTickCount();
DWORD elapsedTime;
ULONG i;

for (i = 0; i < ulCount; i++)
{
if (GetQueuedCompletionStatus(CompletionPort, &lpCompletionPortEntries[i].dwNumberOfBytesTransferred,
&lpCompletionPortEntries[i].lpCompletionKey,
&lpCompletionPortEntries[i].lpOverlapped, dwMilliseconds))
{
numEntriesRemoved++;
}
else
{
DWORD error = GetLastError();
if (error == WAIT_TIMEOUT)
break;
else if (error == ERROR_ABANDONED_WAIT_0)
continue;
else
return FALSE;
}

*ulNumEntriesRemoved = i;
elapsedTime = GetTickCount() - startTime;
if (elapsedTime >= dwMilliseconds)
break;
}

return TRUE;
*ulNumEntriesRemoved = numEntriesRemoved;
return TRUE;
}
42 changes: 42 additions & 0 deletions wrappers/base/ntext_wrapper/MissingVista.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
CsrVerifyRegion
LdrGetFileNameFromLoadAsDataTable
LdrRemoveLoadAsDataTable
LdrResFindResource
LdrResFindResourceDirectory
LdrResSearchResource
LdrpResGetMappingSize
LdrpResGetRCConfig
LdrpResGetResourceDirectory
NtCancelSynchronousIoFile
NtCreateUserProcess
NtInitializeNlsFiles
RtlCleanUpTEBLangLists
RtlCreateEnvironmentEx
RtlCreateProcessParametersEx
RtlExitUserProcess
RtlExpandEnvironmentStrings
RtlInitializeCriticalSectionEx
RtlInitializeExceptionChain
RtlLocaleNameToLcid
RtlQueryElevationFlags
RtlQueryEnvironmentVariable
RtlSetEnvironmentVar
RtlTryAcquirePebLock
RtlWerpReportException
RtlpCheckDynamicTimeZoneInformation
RtlpConvertCultureNamesToLCIDs
RtlpConvertLCIDsToCultureNames
RtlpCreateProcessRegistryInfo
RtlpGetLCIDFromLangInfoNode
RtlpGetNameFromLangInfoNode
RtlpGetSystemDefaultUILanguage
RtlpInitializeLangRegistryInfo
RtlpIsQualifiedLanguage
RtlpLoadMachineUIByPolicy
RtlpLoadUserUIByPolicy
RtlpMuiFreeLangRegistryInfo
TpCaptureCaller
TpCheckTerminateWorker
WerCheckEventEscalation
WerReportSQMEvent
WerReportWatsonEvent
7 changes: 6 additions & 1 deletion wrappers/base/ntext_wrapper/etw/etw.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ BOOL
NTAPI
EtwpIsHeapRangeLoggingEnabled()
{
return TRUE;
return (SharedUserData->TraceLogging >> 30) & 1;
}

BOOL
Expand Down Expand Up @@ -618,4 +618,9 @@ ULONG WINAPI EtwEventWriteTransfer( REGHANDLE handle, PCEVENT_DESCRIPTOR descrip
DbgPrint("%s, %p, %s, %s, %u, %p: stub\n", handle, descriptor,
activity, related, count, data);
return ERROR_SUCCESS;
}

ULONG WINAPI EtwTraceUserEvent(int a1, int a2, __int64 a3, __int64 *a4, __int64 *a5, int a6, char a7)
{
return 0;
}
2 changes: 1 addition & 1 deletion wrappers/base/ntext_wrapper/ntapi/ntapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ NtTraceControl(
PULONG ReturnLength
)
{
return STATUS_SUCCESS;
return STATUS_UNSUCCESSFUL;
}

VOID
Expand Down
Loading

0 comments on commit b04e057

Please sign in to comment.