Skip to content

Commit

Permalink
clean up verbose functions
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmattkc committed Oct 31, 2023
1 parent e7a9014 commit b55b3a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 32 deletions.
37 changes: 8 additions & 29 deletions wrappers/kernel32.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ VOID WINAPI CORKEL32_SetLastError(DWORD err)
DWORD WINAPI CORKEL32_GetLastError()
{
DWORD e = GetLastError();
//Trace((e == 0) ? TRACE_PASSTHROUGH : TRACE_UNEXPECTED_ERROR, "GetLastError: 0x%X", e);
Trace(TRACE_PASSTHROUGH, "GetLastError: 0x%X", e);
return e;
}
Expand All @@ -60,32 +59,12 @@ LONG WINAPI CORKEL32_InterlockedExchange(LPLONG Target, LONG Value)
return InterlockedExchange(Target, Value);
}

const char *ignore_pointers[] = {
"EncodePointer",
"DecodePointer",
"FlsAlloc",
"FlsGetValue",
"FlsSetValue",
"FlsFree",
NULL
};
FARPROC WINAPI CORKEL32_GetProcAddress(HMODULE hModule, LPCSTR lpProcName)
{
FARPROC f = GetProcAddress(hModule, lpProcName);
char buffer[256];
BOOL ignore = FALSE;

int i = 0;
do {
if (!strcmp(ignore_pointers[i], lpProcName)) {
ignore = TRUE;
break;
}
i++;
} while (ignore_pointers[i]);

GetModuleFileNameA(hModule, buffer, 256);
Trace((ignore) ? TRACE_PASSTHROUGH : TRACE_UNEXPECTED_ERROR, "GetProcAddress: %s %s = %p", buffer, lpProcName, f);
Trace((f) ? TRACE_PASSTHROUGH : TRACE_POTENTIAL_ERROR, "GetProcAddress: %s %s = %p", buffer, lpProcName, f);
return f;
}

Expand Down Expand Up @@ -393,14 +372,14 @@ HANDLE WINAPI CORKEL32_GetCurrentProcess()
HMODULE WINAPI CORKEL32_LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
{
HMODULE h = LoadLibraryExA(lpLibFileName, hFile, dwFlags);
Trace(/*(h != NULL) ? TRACE_PASSTHROUGH : TRACE_UNEXPECTED_ERROR*/TRACE_FORCE_PRINT, "LoadLibraryExA: %s - result: %p", lpLibFileName, h);
Trace((h != NULL) ? TRACE_PASSTHROUGH : TRACE_POTENTIAL_ERROR, "LoadLibraryExA: %s - result: %p", lpLibFileName, h);
return h;
}

HMODULE WINAPI CORKEL32_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
{
HMODULE h = LoadLibraryExW(lpLibFileName, hFile, dwFlags);
Trace(/*(h != NULL) ? TRACE_PASSTHROUGH : TRACE_UNEXPECTED_ERROR*/TRACE_FORCE_PRINT, "LoadLibraryExW: %ls - result: %p", lpLibFileName, h);
Trace((h != NULL) ? TRACE_PASSTHROUGH : TRACE_POTENTIAL_ERROR, "LoadLibraryExW: %ls - result: %p", lpLibFileName, h);
return h;
}

Expand Down Expand Up @@ -728,7 +707,7 @@ HANDLE WINAPI CORKEL32_GetStdHandle(DWORD param_0)
HMODULE WINAPI CORKEL32_LoadLibraryA(LPCSTR lpLibFileName)
{
HMODULE h = LoadLibraryA(lpLibFileName);
Trace(/*(h != NULL) ? TRACE_PASSTHROUGH : TRACE_UNEXPECTED_ERROR*/TRACE_FORCE_PRINT, "LoadLibraryA: %s - result: %p", lpLibFileName, h);
Trace((h != NULL) ? TRACE_PASSTHROUGH : TRACE_POTENTIAL_ERROR, "LoadLibraryA: %s - result: %p", lpLibFileName, h);
return h;
}

Expand Down Expand Up @@ -947,7 +926,7 @@ BOOL WINAPI CORKEL32_SetLocalTime(const SYSTEMTIME* param_0)
HMODULE WINAPI CORKEL32_LoadLibraryW(LPCWSTR lpLibFileName)
{
HMODULE h = LoadLibraryW(lpLibFileName);
Trace(/*(h != NULL) ? TRACE_PASSTHROUGH : TRACE_UNEXPECTED_ERROR*/TRACE_FORCE_PRINT, "LoadLibraryW: %ls - result: %p", lpLibFileName, h);
Trace((h != NULL) ? TRACE_PASSTHROUGH : TRACE_POTENTIAL_ERROR, "LoadLibraryW: %ls - result: %p", lpLibFileName, h);
return h;
}

Expand Down Expand Up @@ -1858,14 +1837,14 @@ BOOL WINAPI CORKEL32_GetFileAttributesExW(LPCWSTR name, GET_FILEEX_INFO_LEVELS l
DWORD WINAPI CORKEL32_GetLongPathNameA(LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer)
{
strncpy(lpszLongPath, lpszShortPath, cchBuffer);
Trace(TRACE_UNIMPLEMENTED, "GetLongPathNameA - lpszShortPath: %s, lpszLongPath: %s, cchBuffer: 0x%X", lpszShortPath, lpszLongPath, cchBuffer);
Trace(TRACE_IMPLEMENTED, "GetLongPathNameA - lpszShortPath: %s, lpszLongPath: %s, cchBuffer: 0x%X", lpszShortPath, lpszLongPath, cchBuffer);
return 0;
}

DWORD WINAPI CORKEL32_GetLongPathNameW(LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer)
{
wcsncpy(lpszLongPath, lpszShortPath, cchBuffer);
Trace(TRACE_UNIMPLEMENTED, "GetLongPathNameW - lpszShortPath: %ls, lpszLongPath: %ls, cchBuffer: 0x%X", lpszShortPath, lpszLongPath, cchBuffer);
Trace(TRACE_IMPLEMENTED, "GetLongPathNameW - lpszShortPath: %ls, lpszLongPath: %ls, cchBuffer: 0x%X", lpszShortPath, lpszLongPath, cchBuffer);
return 0;
}

Expand Down Expand Up @@ -1913,7 +1892,7 @@ BOOL WINAPI CORKEL32_SwitchToThread()

BOOL WINAPI CORKEL32_IsProcessorFeaturePresent(DWORD ProcessorFeature)
{
Trace(TRACE_UNIMPLEMENTED, "IsProcessorFeaturePresent: %X", ProcessorFeature);
Trace(TRACE_IMPLEMENTED, "IsProcessorFeaturePresent: %X", ProcessorFeature);
return FALSE;
}

Expand Down
6 changes: 3 additions & 3 deletions wrappers/user32.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ BOOL WINAPI CORUSR_InSendMessage()
// Reimplementations
//

DWORD WINAPI CORUSR_MsgWaitForMultipleObjectsEx(DWORD param_0, const HANDLE* param_1, DWORD param_2, DWORD param_3, DWORD param_4)
DWORD WINAPI CORUSR_MsgWaitForMultipleObjectsEx(DWORD nCount, const HANDLE* pHandles, DWORD dwMilliseconds, DWORD dwWakeMask, DWORD dwFlags)
{
Trace(TRACE_UNIMPLEMENTED, "MsgWaitForMultipleObjectsEx");
return 0;
Trace(TRACE_IMPLEMENTED, "MsgWaitForMultipleObjectsEx");
return WaitForMultipleObjectsEx(nCount, pHandles, (dwFlags & MWMO_WAITALL), dwMilliseconds, (dwFlags & MWMO_ALERTABLE));
}

INT WINAPIV CORUSR_wsprintfW(LPWSTR param_0, LPCWSTR param_1, ...)
Expand Down

0 comments on commit b55b3a1

Please sign in to comment.