1 /***********************************************************************\
2 *                               nddeapi.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 windows.nddeapi;
12 
13 private import windows.windef;
14 nothrow:
15 // FIXME: check types and grouping of constants
16 
17 /+
18 #ifndef CNLEN /* also in lmcons.h */
19 #define CNLEN 15
20 #define UNCLEN (CNLEN + 2)
21 #endif
22 +/
23 
24 const char    SEP_CHAR  = ',';
25 const char[]  BAR_CHAR  = "|";
26 const wchar   SEP_WCHAR = ',';
27 const wchar[] BAR_WCHAR = "|";
28 
29 enum {
30 	NDDE_NO_ERROR,
31 	NDDE_ACCESS_DENIED,
32 	NDDE_BUF_TOO_SMALL,
33 	NDDE_ERROR_MORE_DATA,
34 	NDDE_INVALID_SERVER,
35 	NDDE_INVALID_SHARE,
36 	NDDE_INVALID_PARAMETER,
37 	NDDE_INVALID_LEVEL,
38 	NDDE_INVALID_PASSWORD,
39 	NDDE_INVALID_ITEMNAME,
40 	NDDE_INVALID_TOPIC,
41 	NDDE_INTERNAL_ERROR,
42 	NDDE_OUT_OF_MEMORY,
43 	NDDE_INVALID_APPNAME,
44 	NDDE_NOT_IMPLEMENTED,
45 	NDDE_SHARE_ALREADY_EXIST,
46 	NDDE_SHARE_NOT_EXIST,
47 	NDDE_INVALID_FILENAME,
48 	NDDE_NOT_RUNNING,
49 	NDDE_INVALID_WINDOW,
50 	NDDE_INVALID_SESSION,
51 	NDDE_INVALID_ITEM_LIST,
52 	NDDE_SHARE_DATA_CORRUPTED,
53 	NDDE_REGISTRY_ERROR,
54 	NDDE_CANT_ACCESS_SERVER,
55 	NDDE_INVALID_SPECIAL_COMMAND,
56 	NDDE_INVALID_SECURITY_DESC,
57 	NDDE_TRUST_SHARE_FAIL
58 }
59 
60 const size_t
61 	MAX_NDDESHARENAME = 256,
62 	MAX_DOMAINNAME = 15,
63 	MAX_USERNAME = 15,
64 	MAX_APPNAME = 255,
65 	MAX_TOPICNAME = 255,
66 	MAX_ITEMNAME = 255;
67 
68 const NDDEF_NOPASSWORDPROMPT = 1;
69 const NDDEF_NOCACHELOOKUP    = 2;
70 const NDDEF_STRIP_NDDE       = 4;
71 
72 const SHARE_TYPE_OLD         = 1;
73 const SHARE_TYPE_NEW         = 2;
74 const SHARE_TYPE_STATIC      = 4;
75 
76 const uint
77 	NDDE_CMD_SHOW_MASK     = 0x0000FFFF,
78 	NDDE_TRUST_CMD_SHOW    = 0x10000000,
79 	NDDE_TRUST_SHARE_DEL   = 0x20000000,
80 	NDDE_TRUST_SHARE_INIT  = 0x40000000,
81 	NDDE_TRUST_SHARE_START = 0x80000000;
82 
83 struct NDdeShareInfo_tag {
84 	LONG    lRevision;
85 	LPTSTR  lpszShareName;
86 	LONG    lShareType;
87 	LPTSTR  lpszAppTopicList;
88 	LONG    fSharedFlag;
89 	LONG    fService;
90 	LONG    fStartAppFlag;
91 	LONG    nCmdShow;
92 	LONG[2] qModifyId;
93 	LONG    cNumItems;
94 	LPTSTR  lpszItemList;
95 }
96 extern (C) {	// huh?
97 	NDdeShareInfo_tag  NDDESHAREINFO;
98 	NDdeShareInfo_tag* PNDDESHAREINFO;
99 }
100 
101 extern (Windows) {
102 	UINT NDdeGetErrorStringA(UINT, LPSTR, DWORD);
103 	UINT NDdeGetErrorStringW(UINT, LPWSTR, DWORD);
104 	UINT NDdeGetShareSecurityA(LPSTR, LPSTR, SECURITY_INFORMATION,
105 	  PSECURITY_DESCRIPTOR, DWORD, PDWORD);
106 	UINT NDdeGetShareSecurityW(LPWSTR, LPWSTR, SECURITY_INFORMATION,
107 	  PSECURITY_DESCRIPTOR, DWORD, PDWORD);
108 	UINT NDdeGetTrustedShareA(LPSTR, LPSTR, PDWORD, PDWORD, PDWORD);
109 	UINT NDdeGetTrustedShareW(LPWSTR, LPWSTR, PDWORD, PDWORD, PDWORD);
110 	BOOL NDdeIsValidShareNameA(LPSTR);
111 	BOOL NDdeIsValidShareNameW(LPWSTR);
112 	BOOL NDdeIsValidAppTopicListA(LPSTR);
113 	BOOL NDdeIsValidAppTopicListW(LPWSTR);
114 	UINT NDdeSetShareSecurityA(LPSTR, LPSTR, SECURITY_INFORMATION,
115 	  PSECURITY_DESCRIPTOR);
116 	UINT NDdeSetShareSecurityW(LPWSTR, LPWSTR, SECURITY_INFORMATION,
117 	  PSECURITY_DESCRIPTOR);
118 	UINT NDdeSetTrustedShareA(LPSTR, LPSTR, DWORD);
119 	UINT NDdeSetTrustedShareW(LPWSTR, LPWSTR, DWORD);
120 	UINT NDdeShareAddA(LPSTR, UINT, PSECURITY_DESCRIPTOR, PBYTE, DWORD);
121 	UINT NDdeShareAddW(LPWSTR, UINT, PSECURITY_DESCRIPTOR, PBYTE, DWORD);
122 	UINT NDdeShareDelA(LPSTR, LPSTR, UINT);
123 	UINT NDdeShareDelW(LPWSTR, LPWSTR, UINT);
124 	UINT NDdeShareEnumA(LPSTR, UINT, PBYTE, DWORD, PDWORD, PDWORD);
125 	UINT NDdeShareEnumW(LPWSTR, UINT, PBYTE, DWORD, PDWORD, PDWORD);
126 	UINT NDdeShareGetInfoA(LPSTR, LPSTR, UINT, PBYTE, DWORD, PDWORD, PWORD);
127 	UINT NDdeShareGetInfoW(LPWSTR, LPWSTR, UINT, PBYTE, DWORD, PDWORD, PWORD);
128 	UINT NDdeShareSetInfoA(LPSTR, LPSTR, UINT, PBYTE, DWORD, WORD);
129 	UINT NDdeShareSetInfoW(LPWSTR, LPWSTR, UINT, PBYTE, DWORD, WORD);
130 	UINT NDdeTrustedShareEnumA(LPSTR, UINT, PBYTE, DWORD, PDWORD, PDWORD);
131 	UINT NDdeTrustedShareEnumW(LPWSTR, UINT, PBYTE, DWORD, PDWORD, PDWORD);
132 }
133 
134 version (Unicode) {
135 	alias NDdeShareAddW NDdeShareAdd;
136 	alias NDdeShareDelW NDdeShareDel;
137 	alias NDdeSetShareSecurityW NDdeSetShareSecurity;
138 	alias NDdeGetShareSecurityW NDdeGetShareSecurity;
139 	alias NDdeShareEnumW NDdeShareEnum;
140 	alias NDdeShareGetInfoW NDdeShareGetInfo;
141 	alias NDdeShareSetInfoW NDdeShareSetInfo;
142 	alias NDdeGetErrorStringW NDdeGetErrorString;
143 	alias NDdeIsValidShareNameW NDdeIsValidShareName;
144 	alias NDdeIsValidAppTopicListW NDdeIsValidAppTopicList;
145 	alias NDdeSetTrustedShareW NDdeSetTrustedShare;
146 	alias NDdeGetTrustedShareW NDdeGetTrustedShare;
147 	alias NDdeTrustedShareEnumW NDdeTrustedShareEnum;
148 } else {
149 	alias NDdeShareAddA NDdeShareAdd;
150 	alias NDdeShareDelA NDdeShareDel;
151 	alias NDdeSetShareSecurityA NDdeSetShareSecurity;
152 	alias NDdeGetShareSecurityA NDdeGetShareSecurity;
153 	alias NDdeShareEnumA NDdeShareEnum;
154 	alias NDdeShareGetInfoA NDdeShareGetInfo;
155 	alias NDdeShareSetInfoA NDdeShareSetInfo;
156 	alias NDdeGetErrorStringA NDdeGetErrorString;
157 	alias NDdeIsValidShareNameA NDdeIsValidShareName;
158 	alias NDdeIsValidAppTopicListA NDdeIsValidAppTopicList;
159 	alias NDdeSetTrustedShareA NDdeSetTrustedShare;
160 	alias NDdeGetTrustedShareA NDdeGetTrustedShare;
161 	alias NDdeTrustedShareEnumA NDdeTrustedShareEnum;
162 }