From ef235f7543f3261a0cd886eec927b7f93318d0f4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 2 Nov 2025 03:43:42 +0000 Subject: [PATCH] Fix Windows API mock compilation bugs Fixed 4 compilation errors in system.c: - mock_CloseHandle: Changed undefined 'fd' to 'handle' - mock_LockFile: Changed 'handle' to 'hFile' parameter - mock_UnlockFile: Changed 'handle' to 'hFile' parameter - mock_WriteFile: Added missing comma in WriteFile call All mocks now use correct parameter names matching their function signatures. --- src/system.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/system.c b/src/system.c index 2f44e99..feaf321 100644 --- a/src/system.c +++ b/src/system.c @@ -890,11 +890,11 @@ HANDLE mock_CreateFileW(WCHAR *lpFileName, DWORD dwDesiredAccess, BOOL mock_CloseHandle(HANDLE handle) { - if (fd == INVALID_SOCKET) { + if (handle == INVALID_HANDLE_VALUE) { // TODO return -1; } - int idx = (int) fd; + int idx = (int) handle; Descriptor *desc = ¤t_process->desc[idx]; if (desc->type != DESC_FILE) { @@ -912,11 +912,11 @@ BOOL mock_LockFile(HANDLE hFile, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh) { - if (handle == INVALID_HANDLE_VALUE) { + if (hFile == INVALID_HANDLE_VALUE) { // TODO return FALSE; } - int idx = (int) handle; + int idx = (int) hFile; Descriptor *desc = ¤t_process->desc[idx]; if (desc->type != DESC_FILE) { @@ -939,11 +939,11 @@ BOOL mock_UnlockFile( DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh) { - if (handle == INVALID_HANDLE_VALUE) { + if (hFile == INVALID_HANDLE_VALUE) { // TODO return FALSE; } - int idx = (int) handle; + int idx = (int) hFile; Descriptor *desc = ¤t_process->desc[idx]; if (desc->type != DESC_FILE) { @@ -1007,7 +1007,7 @@ BOOL mock_WriteFile(HANDLE handle, char *src, DWORD len, DWORD *num, OVERLAPPED return -1; } - return WriteFile(desc->real_fd, src, len, num ov); + return WriteFile(desc->real_fd, src, len, num, ov); } BOOL mock_GetFileSizeEx(HANDLE handle, LARGE_INTEGER *buf)