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