Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

  1. //
  2. // NetEnum.h
  3. //
  4. #pragma once
  5. // Callback is called with a NULL pNetResource to indicate no more items to enumerate
  6. typedef BOOL (CALLBACK * NETENUMCALLBACK)(LPVOID pvCallbackParam, LPCTSTR pszComputerName, LPCTSTR pszShareName);
  7. // One global iteration can be happening at a time. If you need
  8. // more than one, instantiate CNetEnum yourself.
  9. void InitNetEnum();
  10. void TermNetEnum();
  11. void EnumComputers(NETENUMCALLBACK pfnCallback, LPVOID pvCallbackParam);
  12. class CNetEnum
  13. {
  14. public:
  15. CNetEnum();
  16. ~CNetEnum();
  17. void EnumComputers(NETENUMCALLBACK pfnCallback, LPVOID pvCallbackParam);
  18. void EnumNetPrinters(NETENUMCALLBACK pfnCallback, LPVOID pvCallbackParam);
  19. void Abort();
  20. protected:
  21. enum JOBTYPE { jtEnumComputers, jtEnumPrinters };
  22. void EnumHelper(JOBTYPE eJobType, NETENUMCALLBACK pfnCallback, LPVOID pvCallbackParam);
  23. static DWORD WINAPI EnumThreadProc(LPVOID pvParam);
  24. void EnumThreadProc();
  25. protected:
  26. CRITICAL_SECTION m_cs;
  27. HANDLE m_hThread;
  28. BOOL m_bAbort;
  29. BOOL m_bNewJob;
  30. JOBTYPE m_eJobType;
  31. NETENUMCALLBACK m_pfnCallback;
  32. LPVOID m_pvCallbackParam;
  33. };