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.

165 lines
7.1 KiB

  1. //
  2. // NetConn.h
  3. //
  4. // Header file for APIs exported by NConn32.dll
  5. //
  6. // History:
  7. //
  8. // 3/12/1999 KenSh Created
  9. // 9/29/1999 KenSh Changed JetNet stuff to NetConn for HNW
  10. //
  11. #ifndef __NETCONN_H__
  12. #define __NETCONN_H__
  13. // Callback procedure - return TRUE to continue, FALSE to abort
  14. typedef BOOL (CALLBACK FAR* PROGRESS_CALLBACK)(LPVOID pvParam, DWORD dwCurrent, DWORD dwTotal);
  15. // NetConn return values
  16. //
  17. #define FACILITY_NETCONN 0x0177
  18. #define NETCONN_SUCCESS MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NETCONN, 0x0000)
  19. #define NETCONN_NEED_RESTART MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NETCONN, 0x0001)
  20. #define NETCONN_ALREADY_INSTALLED MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NETCONN, 0x0002)
  21. #define NETCONN_NIC_INSTALLED MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NETCONN, 0x0003)
  22. #define NETCONN_NIC_INSTALLED_OTHER MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NETCONN, 0x0004)
  23. #define NETCONN_UNKNOWN_ERROR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NETCONN, 0x0000)
  24. #define NETCONN_USER_ABORT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NETCONN, 0x0001)
  25. #define NETCONN_PROTOCOL_NOT_FOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NETCONN, 0x0002)
  26. #define NETCONN_NOT_IMPLEMENTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NETCONN, 0x0003)
  27. #define NETCONN_WRONG_PLATFORM MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NETCONN, 0x0004)
  28. #define NETCONN_MISSING_DLL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NETCONN, 0x0005)
  29. #define NETCONN_OS_NOT_SUPPORTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_NETCONN, 0x0006)
  30. #define SZ_CLASS_ADAPTER L"Net"
  31. #define SZ_CLASS_CLIENT L"NetClient"
  32. #define SZ_CLASS_PROTOCOL L"NetTrans"
  33. #define SZ_CLASS_SERVICE L"NetService"
  34. #define SZ_PROTOCOL_TCPIP L"MSTCP"
  35. #define SZ_PROTOCOL_NETBEUI L"NETBEUI"
  36. #define SZ_PROTOCOL_IPXSPX L"NWLINK"
  37. #define SZ_SERVICE_VSERVER L"VSERVER"
  38. #define SZ_CLIENT_MICROSOFT L"VREDIR"
  39. #define SZ_CLIENT_NETWARE L"NWREDIR"
  40. #define NIC_UNKNOWN 0x00
  41. #define NIC_VIRTUAL 0x01
  42. #define NIC_ISA 0x02
  43. #define NIC_PCI 0x03
  44. #define NIC_PCMCIA 0x04
  45. #define NIC_USB 0x05
  46. #define NIC_PARALLEL 0x06
  47. #define NIC_MF 0x07
  48. #define NIC_1394 0x08 // NDIS 1394 Net Adapter
  49. #define NETTYPE_LAN 0x00 // a network card
  50. #define NETTYPE_DIALUP 0x01 // a Dial-Up Networking adapter
  51. #define NETTYPE_IRDA 0x02 // an IrDA connection
  52. #define NETTYPE_PPTP 0x03 // a virtual private networking adapter for PPTP
  53. #define NETTYPE_TV 0x04 // a TV adapter
  54. #define NETTYPE_ISDN 0x05 // ISDN adapter
  55. #define SUBTYPE_NONE 0x00 // nothing special
  56. #define SUBTYPE_ICS 0x01 // ICS adapter (NIC_VIRTUAL, NETTYPE_LAN)
  57. #define SUBTYPE_AOL 0x02 // AOL adapter (NIC_VIRTUAL, NETTYPE_LAN)
  58. #define SUBTYPE_VPN 0x03 // VPN support (NETTYPE_DIALUP)
  59. #define ICS_NONE 0x00 // NIC has no connection to ICS
  60. #define ICS_EXTERNAL 0x01 // NIC is ICS's external adapter
  61. #define ICS_INTERNAL 0x02 // NIC is ICS's internal adapter
  62. #define NICERR_NONE 0x00 // no error
  63. #define NICERR_MISSING 0x01 // device is in registry but not physically present
  64. #define NICERR_DISABLED 0x02 // device exists but has been disabled (red X in devmgr)
  65. #define NICERR_BANGED 0x03 // device has a problem (yellow ! in devmgr)
  66. #define NICERR_CORRUPT 0x04 // NIC has class key but no enum key
  67. #define NICWARN_NONE 0x00 // no warning
  68. #define NICWARN_WARNING 0x01 // yellow ! in devmgr, otherwise everything looks ok
  69. #include <pshpack1.h>
  70. typedef struct tagNETADAPTER {
  71. WCHAR szDisplayName[260]; // so-called friendly name of adapter
  72. WCHAR szDeviceID[260]; // e.g. "PCI\VEN_10b7&DEV_9050"
  73. WCHAR szEnumKey[260]; // e.g. "Enum\PCI\VEN_10b7&DEV_9050&SUBSYS_00000000&REV_00\407000"
  74. WCHAR szClassKey[40]; // PnP-assigned class name + ID, e.g. "Net\0000"
  75. WCHAR szManufacturer[60]; // Company that manufactured the card, e.g. "3Com"
  76. WCHAR szInfFileName[50]; // File title of INF file, e.g. "NETEL90X.INF"
  77. BYTE bNicType; // a NIC_xxx constant, defined above
  78. BYTE bNetType; // a NETTYPE_xxx constant, defined above
  79. BYTE bNetSubType; // a SUBTYPE_xxx constant, defined above
  80. BYTE bIcsStatus; // an ICS_xxx constant, defined above
  81. BYTE bError; // a NICERR_xxx constant, defined above
  82. BYTE bWarning; // a NICWARN_xxx constant, defined above
  83. DWORD devnode; // configmg device node
  84. } NETADAPTER;
  85. typedef struct tagNETSERVICE {
  86. WCHAR szDisplayName[260]; // (supposedly) friendly name of service
  87. WCHAR szDeviceID[260]; // e.g. "VSERVER"
  88. WCHAR szClassKey[40]; // PnP-assigned class name + ID, e.g. "NetService\0000"
  89. } NETSERVICE;
  90. #include <poppack.h>
  91. #ifdef __cplusplus
  92. extern "C" {
  93. #endif
  94. // NCONN32.DLL exported functions
  95. //
  96. // NOTE: if you change anything here, change NConn32.cpp also!!
  97. //
  98. LPVOID WINAPI NetConnAlloc(DWORD cbAlloc);
  99. VOID WINAPI NetConnFree(LPVOID pMem);
  100. BOOL WINAPI IsProtocolInstalled(LPCWSTR pszProtocolDeviceID, BOOL bExhaustive);
  101. HRESULT WINAPI InstallProtocol(LPCWSTR pszProtocol, HWND hwndParent, PROGRESS_CALLBACK pfnCallback, LPVOID pvCallbackParam);
  102. HRESULT WINAPI InstallTCPIP(HWND hwndParent, PROGRESS_CALLBACK pfnProgress, LPVOID pvProgressParam);
  103. HRESULT WINAPI RemoveProtocol(LPCWSTR pszProtocol);
  104. BOOL WINAPI IsMSClientInstalled(BOOL bExhaustive);
  105. HRESULT WINAPI InstallMSClient(HWND hwndParent, PROGRESS_CALLBACK pfnProgress, LPVOID pvProgressParam);
  106. HRESULT WINAPI EnableBrowseMaster();
  107. BOOL WINAPI IsSharingInstalled(BOOL bExhaustive);
  108. BOOL WINAPI IsFileSharingEnabled();
  109. BOOL WINAPI IsPrinterSharingEnabled();
  110. HRESULT WINAPI InstallSharing(HWND hwndParent, PROGRESS_CALLBACK pfnProgress, LPVOID pvProgressParam);
  111. BOOL WINAPI FindConflictingService(LPCWSTR pszWantService, NETSERVICE* pConflict);
  112. HRESULT WINAPI EnableSharingAppropriately();
  113. int WINAPI EnumNetAdapters(NETADAPTER FAR** pprgNetAdapters);
  114. HRESULT WINAPI InstallNetAdapter(LPCWSTR pszDeviceID, LPCWSTR pszInfPath, HWND hwndParent, PROGRESS_CALLBACK pfnProgress, LPVOID pvCallbackParam);
  115. BOOL WINAPI IsAccessControlUserLevel();
  116. HRESULT WINAPI DisableUserLevelAccessControl();
  117. HRESULT WINAPI EnableQuickLogon();
  118. BOOL WINAPI IsProtocolBoundToAdapter(LPCWSTR pszProtocolID, const NETADAPTER* pAdapter);
  119. HRESULT WINAPI EnableNetAdapter(const NETADAPTER* pAdapter);
  120. BOOL WINAPI IsClientInstalled(LPCWSTR pszClient, BOOL bExhaustive);
  121. HRESULT WINAPI RemoveClient(LPCWSTR pszClient);
  122. HRESULT WINAPI RemoveGhostedAdapters(LPCWSTR pszDeviceID);
  123. HRESULT WINAPI RemoveUnknownAdapters(LPCWSTR pszDeviceID);
  124. BOOL WINAPI DoesAdapterMatchDeviceID(const NETADAPTER* pAdapter, LPCWSTR pszDeviceID);
  125. BOOL WINAPI IsAdapterBroadband(const NETADAPTER* pAdapter);
  126. void WINAPI SaveBroadbandSettings(LPCWSTR pszBroadbandAdapterNumber);
  127. BOOL WINAPI UpdateBroadbandSettings(LPWSTR pszEnumKeyBuf, int cchEnumKeyBuf);
  128. HRESULT WINAPI DetectHardware(LPCWSTR pszDeviceID);
  129. int WINAPI EnumMatchingNetBindings(LPCWSTR pszParentBinding, LPCWSTR pszDeviceID, LPWSTR** pprgBindings);
  130. HRESULT WINAPI RestartNetAdapter(DWORD devnode);
  131. HRESULT WINAPI HrFromLastWin32Error();
  132. HRESULT WINAPI HrWideCharToMultiByte( const WCHAR* szwString, char** ppszString );
  133. HRESULT WINAPI HrEnableDhcp( VOID* pContext, DWORD dwFlags );
  134. BOOLEAN WINAPI IsAdapterDisconnected( VOID* pContext );
  135. HRESULT WINAPI IcsUninstall(void);
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139. #endif // !__NETCONN_H__