Locked how? You can set it to be read-only and hidden using SetFileAttributes. That's a quick and easy way to prevent simple viewing of and writing to the directory:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void werror ( void )
{
char msg[BUFSIZ];
DWORD err = GetLastError();
FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
MAKELANGID ( LANG_NEUTRAL, SUBLANG_DEFAULT ), msg, BUFSIZ, NULL );
fprintf ( stderr, "%s", msg );
exit ( EXIT_FAILURE );
}
int main ( int argc, char *argv[] )
{
BOOL rc;
if ( argc < 2 ) {
fprintf ( stderr, "usage: $prog <file>\n" );
exit ( EXIT_FAILURE );
}
rc = SetFileAttributes ( argv[1],
FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY );
if ( rc == 0 )
werror();
return EXIT_SUCCESS;
} Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401