Skip to content

Instantly share code, notes, and snippets.

@sunnyneo
Forked from dadevel/main.c
Created May 10, 2024 00:38
Show Gist options
  • Select an option

  • Save sunnyneo/8383d81747d83a2d1175783f62901930 to your computer and use it in GitHub Desktop.

Select an option

Save sunnyneo/8383d81747d83a2d1175783f62901930 to your computer and use it in GitHub Desktop.

Revisions

  1. @dadevel dadevel created this gist May 7, 2024.
    10 changes: 10 additions & 0 deletions main.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #include <windows.h>

    int main() {
    HANDLE file = CreateFileA(".\\test.txt", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_ENCRYPTED|FILE_FLAG_DELETE_ON_CLOSE, NULL);
    if (!file || file == INVALID_HANDLE_VALUE) {
    return GetLastError();
    }
    CloseHandle(file);
    return 0;
    }