Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ProDC NgcAs.exe #57

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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