1 /***********************************************************************\ 2 * nspapi.d * 3 * * 4 * Windows API header module * 5 * * 6 * Translated from MinGW Windows headers * 7 * by Stewart Gordon * 8 * * 9 * Placed into public domain * 10 \***********************************************************************/ 11 module win32.nspapi; 12 version(Windows): 13 14 private import win32.basetyps, win32.windef; 15 16 // FIXME: check types of constants 17 18 enum { 19 NS_ALL = 0, 20 21 NS_SAP, 22 NS_NDS, 23 NS_PEER_BROWSE, 24 25 NS_TCPIP_LOCAL = 10, 26 NS_TCPIP_HOSTS, 27 NS_DNS, 28 NS_NETBT, 29 NS_WINS, 30 31 NS_NBP = 20, 32 33 NS_MS = 30, 34 NS_STDA, 35 NS_NTDS, 36 37 NS_X500 = 40, 38 NS_NIS, 39 NS_NISPLUS, 40 41 NS_WRQ = 50 42 } 43 44 enum { 45 SERVICE_REGISTER = 1, 46 SERVICE_DEREGISTER = 2, 47 SERVICE_FLUSH = 3, 48 SERVICE_FLAG_HARD = 2 49 } 50 51 /* MinGW makes the next section conditional on winsock.h or winsock2.h 52 * being included. But that doesn't translate well into D. 53 */ 54 version (Win32_Winsock1) { 55 import win32.winsock; 56 } else { 57 import win32.winsock2; 58 } 59 60 struct SOCKET_ADDRESS { 61 LPSOCKADDR lpSockaddr; 62 INT iSockaddrLength; 63 } 64 alias SOCKET_ADDRESS* PSOCKET_ADDRESS, LPSOCKET_ADDRESS; 65 66 struct CSADDR_INFO { 67 SOCKET_ADDRESS LocalAddr; 68 SOCKET_ADDRESS RemoteAddr; 69 INT iSocketType; 70 INT iProtocol; 71 } 72 alias CSADDR_INFO* PCSADDR_INFO, LPCSADDR_INFO; 73 74 struct BLOB { 75 ULONG cbSize; 76 BYTE* pBlobData; 77 } 78 alias BLOB* PBLOB, LPBLOB; 79 80 struct SERVICE_ADDRESS { 81 DWORD dwAddressType; 82 DWORD dwAddressFlags; 83 DWORD dwAddressLength; 84 DWORD dwPrincipalLength; 85 BYTE* lpAddress; 86 BYTE* lpPrincipal; 87 } 88 89 struct SERVICE_ADDRESSES { 90 DWORD dwAddressCount; 91 SERVICE_ADDRESS _Addresses; 92 93 SERVICE_ADDRESS* Addresses() { return &_Addresses; } 94 } 95 alias SERVICE_ADDRESSES* PSERVICE_ADDRESSES, LPSERVICE_ADDRESSES; 96 97 struct SERVICE_INFOA { 98 LPGUID lpServiceType; 99 LPSTR lpServiceName; 100 LPSTR lpComment; 101 LPSTR lpLocale; 102 DWORD dwDisplayHint; 103 DWORD dwVersion; 104 DWORD dwTime; 105 LPSTR lpMachineName; 106 LPSERVICE_ADDRESSES lpServiceAddress; 107 BLOB ServiceSpecificInfo; 108 } 109 alias SERVICE_INFOA* LPSERVICE_INFOA; 110 111 struct SERVICE_INFOW { 112 LPGUID lpServiceType; 113 LPWSTR lpServiceName; 114 LPWSTR lpComment; 115 LPWSTR lpLocale; 116 DWORD dwDisplayHint; 117 DWORD dwVersion; 118 DWORD dwTime; 119 LPWSTR lpMachineName; 120 LPSERVICE_ADDRESSES lpServiceAddress; 121 BLOB ServiceSpecificInfo; 122 } 123 alias SERVICE_INFOW* LPSERVICE_INFOW; 124 125 alias void* LPSERVICE_ASYNC_INFO; 126 127 extern (Windows) { 128 INT SetServiceA(DWORD, DWORD, DWORD, LPSERVICE_INFOA, 129 LPSERVICE_ASYNC_INFO, LPDWORD); 130 INT SetServiceW(DWORD, DWORD, DWORD, LPSERVICE_INFOW, 131 LPSERVICE_ASYNC_INFO, LPDWORD); 132 INT GetAddressByNameA(DWORD, LPGUID, LPSTR, LPINT, DWORD, 133 LPSERVICE_ASYNC_INFO, LPVOID, LPDWORD, LPSTR, LPDWORD); 134 INT GetAddressByNameW(DWORD, LPGUID, LPWSTR, LPINT, DWORD, 135 LPSERVICE_ASYNC_INFO, LPVOID, LPDWORD, LPWSTR, LPDWORD); 136 } 137 138 version (Unicode) { 139 alias SERVICE_INFOW SERVICE_INFO; 140 alias SetServiceW SetService; 141 alias GetAddressByNameW GetAddressByName; 142 } else { 143 alias SERVICE_INFOA SERVICE_INFO; 144 alias SetServiceA SetService; 145 alias GetAddressByNameA GetAddressByName; 146 } 147 148 alias SERVICE_INFO _SERVICE_INFO; 149 alias SERVICE_INFO* LPSERVICE_INFO;