Ответить на сообщение
Вернуться к теме
Вы отвечаете на сообщение:
Автор: xyk (14.04.2007 в 16:31) нужно получить по домену список машин в его сети и для этих машин расшаренные папки Я вроде разобрался, но пример из msdn , NetShareEnum всё время возвращает мне ошибку с кодом 53. Я нашёл что 53 ошибка это неверный путь... Подскажите как мне заставить правильно работать пример Сам код
#define UNICODE #include <windows.h> #include <stdio.h> #include <lm.h> void wmain( int argc, TCHAR *lpszArgv[ ]) { PSHARE_INFO_502 BufPtr,p; NET_API_STATUS res; LPTSTR lpszServer = NULL; DWORD er=0,tr=0,resume=0, i; switch(argc) { case 2: lpszServer = lpszArgv[1]; break; default: printf("Usage: NetShareEnum <servername>\n"); return; } // // Print a report header. // printf("Share: Local Path: Uses: Descriptor:\n"); printf("---------------------------------------------------------------------\n"); // // Call the NetShareEnum function; specify level 502. // do // begin do { res = NetShareEnum (lpszServer, 502, (LPBYTE *) &BufPtr, -1, &er, &tr, &resume); // // If the call succeeds, // if(res == ERROR_SUCCESS || res == ERROR_MORE_DATA) // тут не проходит { p=BufPtr; // // Loop through the entries; // print retrieved data. // for(i=1;i<=er;i++) { printf("%-20S%-30S%-8u",p->shi502_netname, p->shi502_path, p->shi502_current_uses); // // Validate the value of the // shi502_security_descriptor member. // if (IsValidSecurityDescriptor(p->shi502_security_descriptor)) printf("Yes\n"); else printf("No\n"); p++; } // // Free the allocated buffer. // NetApiBufferFree(BufPtr); } else printf("Error: %ld\n",res); } // Continue to call NetShareEnum while // there are more entries. // while (res==ERROR_MORE_DATA); // end do return; }
Ваше имя:
Пароль:
Цитировать Используйте тэги для выделения текста: Код: [code][/code] Жирный: [b][/b] Наклонный: [i][/i] URL: [url][/url]
Сообщение:
Прикрепить: