Source code of Windows XP (NT5)
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.

75 lines
1.7 KiB

  1. /*
  2. * History:
  3. * kevinl 08-Jan-1991 Created
  4. */
  5. #include "winfile.h"
  6. #include <winnet.h>
  7. #include "wnetcaps.h"
  8. UINT wConnectionCaps ;
  9. UINT wDialogCaps ;
  10. UINT wAdminCaps ;
  11. /*****
  12. *
  13. * WNetGetCaps
  14. *
  15. * WinNet API Function -- see spec for parms and return values.
  16. *
  17. */
  18. UINT
  19. WNetGetCaps(
  20. UINT nIndex
  21. )
  22. {
  23. /* Under NT, the network can be stopped at anytime, so we
  24. * check everytime someone queries what capabilities we have.
  25. * Thus overall, we represent a consistent picture to the user (though
  26. * there will be times when an application may be out of date).
  27. */
  28. DWORD dwRet;
  29. DWORD dwBuffSize = 50;
  30. CHAR szUserName[50];
  31. dwRet = WNetGetUser( NULL, szUserName, &dwBuffSize );
  32. switch ( dwRet ) {
  33. case WN_NO_NETWORK:
  34. wConnectionCaps = 0 ;
  35. wDialogCaps = 0 ;
  36. wAdminCaps = 0 ;
  37. break ;
  38. default:
  39. wConnectionCaps = ( WNNC_CON_ADDCONNECTION |
  40. WNNC_CON_CANCELCONNECTION |
  41. WNNC_CON_GETCONNECTIONS );
  42. wDialogCaps = ( WNNC_DLG_CONNECTIONDIALOG |
  43. WNNC_DLG_DEVICEMODE |
  44. WNNC_DLG_PROPERTYDIALOG ) ;
  45. wAdminCaps = ( WNNC_ADM_GETDIRECTORYTYPE |
  46. WNNC_ADM_DIRECTORYNOTIFY ) ;
  47. break ;
  48. }
  49. switch (nIndex) {
  50. case WNNC_CONNECTION:
  51. return wConnectionCaps;
  52. case WNNC_DIALOG:
  53. return wDialogCaps;
  54. case WNNC_ADMIN:
  55. return wAdminCaps;
  56. default:
  57. return 0;
  58. }
  59. } /* WNetGetCaps */