Skip to content

Commit

Permalink
Support ProDC NgcAs.exe (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkst authored Oct 22, 2023
1 parent 30ef434 commit 0f8fb7f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
30 changes: 30 additions & 0 deletions dll/kernel32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,26 @@ namespace kernel32 {
return 1;
}

unsigned int WIN_FUNC GetProcessWorkingSetSize(void *hProcess, unsigned int *lpMinimumWorkingSetSize, unsigned int *lpMaximumWorkingSetSize) {
DEBUG_LOG("GetProcessWorkingSetSize\n");
// A pointer to a variable that receives the minimum working set size of the specified process, in bytes.
// The virtual memory manager attempts to keep at least this much memory resident in the process whenever the process is active.
*lpMinimumWorkingSetSize = 32*1024*1024; // 32MB

// A pointer to a variable that receives the maximum working set size of the specified process, in bytes.
// The virtual memory manager attempts to keep no more than this much memory resident in the process whenever
// the process is active when memory is in short supply.
*lpMaximumWorkingSetSize = 128*1024*1024; // 128MB

// If the function succeeds, the return value is nonzero.
return 1;
}

unsigned int WIN_FUNC SetProcessWorkingSetSize(void *hProcess, unsigned int dwMinimumWorkingSetSize, unsigned int dwMaximumWorkingSetSize) {
DEBUG_LOG("SetProcessWorkingSetSize: min %u, max: %u\n", dwMinimumWorkingSetSize, dwMaximumWorkingSetSize);
return 1;
}

typedef struct _STARTUPINFOA {
unsigned int cb;
char *lpReserved;
Expand Down Expand Up @@ -2050,6 +2070,11 @@ namespace kernel32 {
}
}

BOOL WIN_FUNC GetOverlappedResult(void *hFile, void *lpOverlapped, int *lpNumberOfBytesTransferred, BOOL bWait) {
// DEBUG_LOG("GetOverlappedResult(%p, %p, %p, %u)\n", hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait);
return 1;
}

}

static void *resolveByName(const char *name) {
Expand Down Expand Up @@ -2212,6 +2237,8 @@ static void *resolveByName(const char *name) {
// memoryapi.h
if (strcmp(name, "VirtualAlloc") == 0) return (void *) kernel32::VirtualAlloc;
if (strcmp(name, "VirtualFree") == 0) return (void *) kernel32::VirtualFree;
if (strcmp(name, "GetProcessWorkingSetSize") == 0) return (void *) kernel32::GetProcessWorkingSetSize;
if (strcmp(name, "SetProcessWorkingSetSize") == 0) return (void *) kernel32::SetProcessWorkingSetSize;

// stringapiset.h
if (strcmp(name, "WideCharToMultiByte") == 0) return (void *) kernel32::WideCharToMultiByte;
Expand Down Expand Up @@ -2244,6 +2271,9 @@ static void *resolveByName(const char *name) {
if (strcmp(name, "FlsSetValue") == 0) return (void *) kernel32::FlsSetValue;
if (strcmp(name, "FlsGetValue") == 0) return (void *) kernel32::FlsGetValue;

// ioapiset.h
if (strcmp(name, "GetOverlappedResult") == 0) return (void *) kernel32::GetOverlappedResult;

return 0;
}

Expand Down
4 changes: 3 additions & 1 deletion dll/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
namespace version {
unsigned int WIN_FUNC GetFileVersionInfoSizeA(const char* lptstrFilename, unsigned int* outZero) {
DEBUG_LOG("GetFileVersionInfoSizeA %s\n", lptstrFilename);
*outZero = 0;
if (outZero != NULL) {
*outZero = 0;
}
wibo::lastError = 0;
return 0;
}
Expand Down

0 comments on commit 0f8fb7f

Please sign in to comment.