Files
ma/src/client_backend/permissions.cpp
jakani24 b931c524a1 added some code
wrote some code to test some functionallity
2023-11-02 16:41:35 +01:00

27 lines
558 B
C++

#ifndef PERMISSIONS_CPP
#define PERMISSIONS_CPP
#include "permissions.h"
/*
1 create file (as admin)
2 set file as read only (also as admin)
file cannot be deleted or modified by anyone. admin can delete
*/
/*
int main() {
FILE* fp;
fp = fopen("c:\\programdata\\jakach\\aa.txt", "w");
fprintf(fp, "secure text");
fclose(fp);
chmod("c:\\programdata\\jakach\\aa.txt", _S_IREAD);
}
*/
int protect_file(char* path) {
return _chmod(path, _S_IREAD);
}
int unprotect_file(char* path) {
return _chmod(path, _S_IWRITE | _S_IREAD);
}
#endif