Ordner im Netzwerk freigeben
-
Hallo,
Ich möchte gerne gew. Unterordner meines Programms im SMB Netzwerk von Windows für bestimmte User freigeben. Könnt ihr mir einige Anhaltspunkte geben, nach was ich suchen muss?
hef@x
-
habs schon rausgefunden
#define UNICODE #include <windows.h> #include <stdio.h> #include <lm.h> #pragma comment(lib, "Netapi32.lib") void main( int argc, TCHAR *argv[ ]) { NET_API_STATUS res; SHARE_INFO_2 p; DWORD parm_err = 0; // if(argc<2) // printf("Usage: NetShareAdd server\n"); // else { // // Fill in the SHARE_INFO_2 structure. // p.shi2_netname = TEXT("TESTSHARE"); p.shi2_type = STYPE_DISKTREE; // disk drive p.shi2_remark = TEXT("TESTSHARE to test NetShareAdd"); p.shi2_permissions = 0; p.shi2_max_uses = 4; p.shi2_current_uses = 0; p.shi2_path = TEXT("C:\\"); p.shi2_passwd = NULL; // no password // // Call the NetShareAdd function, // specifying level 2. // res=NetShareAdd(NULL, 2, (LPBYTE) &p, &parm_err); // // If the call succeeds, inform the user. // if(res==0) printf("Share created.\n"); // Otherwise, print an error, // and identify the parameter in error. // else printf("Error: %u\tparmerr=%u\n", res, parm_err); } return; }