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.

90 lines
1.7 KiB

  1. #include <windows.h>
  2. #include <lmcons.h>
  3. #include <lmerr.h>
  4. #include <lmshare.h>
  5. #include <lmserver.h>
  6. int
  7. main (
  8. int argc,
  9. char *argv[]
  10. )
  11. {
  12. LPBYTE buffer;
  13. DWORD entries;
  14. DWORD totalEntries;
  15. NET_API_STATUS status;
  16. #if 0
  17. status = I_NetServerSetServiceBits( NULL, 0x5555AAAA );
  18. if ( status != NERR_Success ) {
  19. printf( "I_NetServerSetServiceBits failed: %ld\n", status );
  20. }
  21. #endif
  22. #if 0
  23. status = NetServerDiskEnum(
  24. NULL,
  25. 0,
  26. &buffer,
  27. -1,
  28. &entries,
  29. &totalEntries,
  30. NULL
  31. );
  32. if ( status != NERR_Success ) {
  33. printf( "NetServerDiskEnum failed: %ld\n", status );
  34. } else {
  35. PSZ p = buffer;
  36. DWORD i = 0;
  37. while ( *p != 0 ) {
  38. printf( "Disk %ld is %s\n", i, p );
  39. while ( *(++p) != 0 ) ;
  40. p++;
  41. i++;
  42. }
  43. if ( i != entries ) {
  44. printf( "Incorrect entry count returned: %ld\n", entries );
  45. }
  46. }
  47. return status;
  48. #endif
  49. #if 1
  50. status = NetShareEnum(
  51. "",
  52. 0,
  53. &buffer,
  54. 8192,
  55. &entries,
  56. &totalEntries,
  57. NULL
  58. );
  59. if ( status != NERR_Success ) {
  60. printf( "NetShareEnum failed: %ld\n", status );
  61. } else {
  62. printf( "NetShareEnum worked.\n" );
  63. printf( " entries = %ld, totalEntries = %ld\n",
  64. entries, totalEntries );
  65. }
  66. return status;
  67. #endif
  68. } // main