MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / windows_complete_write

Function windows_complete_write

src/daemon/service.c:917–936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

915}
916
917static bool windows_complete_write(HANDLE file, const char *record, size_t length,
918 LARGE_INTEGER original_size) {
919 LARGE_INTEGER end = {.QuadPart = 0};
920 if (!SetFilePointerEx(file, end, NULL, FILE_END)) {
921 return false;
922 }
923 size_t written = 0;
924 while (written < length) {
925 DWORD chunk = length - written > MAXDWORD ? MAXDWORD : (DWORD)(length - written);
926 DWORD count = 0;
927 if (!WriteFile(file, record + written, chunk, &count, NULL) || count == 0) {
928 LARGE_INTEGER rollback = original_size;
929 (void)SetFilePointerEx(file, rollback, NULL, FILE_BEGIN);
930 (void)SetEndOfFile(file);
931 return false;
932 }
933 written += count;
934 }
935 return FlushFileBuffers(file) != 0;
936}
937
938static bool windows_log_append(const char *log_path, const char *record, size_t record_length,
939 size_t cap_bytes) {

Callers 1

windows_log_appendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected