1 /***********************************************************************\
2 *                               lmshare.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 module windows.lmshare;
11 //version(Win32)
12 //	pragma(lib, "netapi");
13 nothrow:
14 import windows.lmcons;
15 private import windows.w32api, windows.windef;
16 
17 
18 const SHARE_NETNAME_PARMNUM      = 1;
19 const SHARE_TYPE_PARMNUM         = 3;
20 const SHARE_REMARK_PARMNUM       = 4;
21 const SHARE_PERMISSIONS_PARMNUM  = 5;
22 const SHARE_MAX_USES_PARMNUM     = 6;
23 const SHARE_CURRENT_USES_PARMNUM = 7;
24 const SHARE_PATH_PARMNUM         = 8;
25 const SHARE_PASSWD_PARMNUM       = 9;
26 const SHARE_FILE_SD_PARMNUM      = 501;
27 const SHARE_REMARK_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + SHARE_REMARK_PARMNUM;
28 const SHARE_MAX_USES_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + SHARE_MAX_USES_PARMNUM;
29 const SHARE_FILE_SD_INFOLEVEL  = PARMNUM_BASE_INFOLEVEL + SHARE_FILE_SD_PARMNUM;
30 
31 const SHI1_NUM_ELEMENTS = 4;
32 const SHI2_NUM_ELEMENTS = 10;
33 
34 const STYPE_DISKTREE = 0;
35 const STYPE_PRINTQ   = 1;
36 const STYPE_DEVICE   = 2;
37 const STYPE_IPC      = 3;
38 const STYPE_DFS      = 100;
39 const STYPE_SPECIAL  = 0x80000000;
40 
41 const DWORD SHI_USES_UNLIMITED = -1;
42 
43 const SESS_GUEST = 1;
44 const SESS_NOENCRYPTION = 2;
45 const SESI1_NUM_ELEMENTS = 8;
46 const SESI2_NUM_ELEMENTS = 9;
47 
48 const PERM_FILE_READ   = 1;
49 const PERM_FILE_WRITE  = 2;
50 const PERM_FILE_CREATE = 4;
51 
52 struct FILE_INFO_2 {
53 	DWORD fi2_id;
54 }
55 alias FILE_INFO_2* PFILE_INFO_2, LPFILE_INFO_2;
56 
57 struct FILE_INFO_3 {
58 	DWORD fi3_id;
59 	DWORD fi3_permissions;
60 	DWORD fi3_num_locks;
61 	LPTSTR fi3_pathname;
62 	LPTSTR fi3_username;
63 }
64 alias FILE_INFO_3* PFILE_INFO_3, LPFILE_INFO_3;
65 
66 struct SHARE_INFO_0 {
67 	LPTSTR shi0_netname;
68 }
69 alias SHARE_INFO_0* PSHARE_INFO_0, LPSHARE_INFO_0;
70 
71 struct SHARE_INFO_1 {
72 	LPTSTR shi1_netname;
73 	DWORD shi1_type;
74 	LPTSTR shi1_remark;
75 }
76 alias SHARE_INFO_1* PSHARE_INFO_1, LPSHARE_INFO_1;
77 
78 struct SHARE_INFO_2 {
79 	LPTSTR shi2_netname;
80 	DWORD shi2_type;
81 	LPTSTR shi2_remark;
82 	DWORD shi2_permissions;
83 	DWORD shi2_max_uses;
84 	DWORD shi2_current_uses;
85 	LPTSTR shi2_path;
86 	LPTSTR shi2_passwd;
87 }
88 alias SHARE_INFO_2* PSHARE_INFO_2, LPSHARE_INFO_2;
89 
90 struct SHARE_INFO_502 {
91 	LPTSTR shi502_netname;
92 	DWORD shi502_type;
93 	LPTSTR shi502_remark;
94 	DWORD shi502_permissions;
95 	DWORD shi502_max_uses;
96 	DWORD shi502_current_uses;
97 	LPTSTR shi502_path;
98 	LPTSTR shi502_passwd;
99 	DWORD shi502_reserved;
100 	PSECURITY_DESCRIPTOR shi502_security_descriptor;
101 }
102 alias SHARE_INFO_502* PSHARE_INFO_502, LPSHARE_INFO_502;
103 
104 struct SHARE_INFO_1004 {
105 	LPTSTR shi1004_remark;
106 }
107 alias SHARE_INFO_1004* PSHARE_INFO_1004, LPSHARE_INFO_1004;
108 
109 struct SHARE_INFO_1006 {
110 	DWORD shi1006_max_uses;
111 }
112 alias SHARE_INFO_1006* PSHARE_INFO_1006, LPSHARE_INFO_1006;
113 
114 struct SHARE_INFO_1501 {
115 	DWORD shi1501_reserved;
116 	PSECURITY_DESCRIPTOR shi1501_security_descriptor;
117 }
118 alias SHARE_INFO_1501* PSHARE_INFO_1501, LPSHARE_INFO_1501;
119 
120 struct SESSION_INFO_0 {
121 	LPWSTR sesi0_cname;
122 }
123 alias SESSION_INFO_0* PSESSION_INFO_0, LPSESSION_INFO_0;
124 
125 struct SESSION_INFO_1 {
126 	LPTSTR sesi1_cname;
127 	LPTSTR sesi1_username;
128 	DWORD sesi1_num_opens;
129 	DWORD sesi1_time;
130 	DWORD sesi1_idle_time;
131 	DWORD sesi1_user_flags;
132 }
133 alias SESSION_INFO_1* PSESSION_INFO_1, LPSESSION_INFO_1;
134 
135 struct SESSION_INFO_2 {
136 	LPTSTR sesi2_cname;
137 	LPTSTR sesi2_username;
138 	DWORD sesi2_num_opens;
139 	DWORD sesi2_time;
140 	DWORD sesi2_idle_time;
141 	DWORD sesi2_user_flags;
142 	LPWSTR sesi2_cltype_name;
143 }
144 alias SESSION_INFO_2* PSESSION_INFO_2, LPSESSION_INFO_2;
145 
146 struct SESSION_INFO_10 {
147 	LPWSTR sesi10_cname;
148 	LPWSTR sesi10_username;
149 	DWORD sesi10_time;
150 	DWORD sesi10_idle_time;
151 }
152 alias SESSION_INFO_10* PSESSION_INFO_10, LPSESSION_INFO_10;
153 
154 struct SESSION_INFO_502 {
155 	LPWSTR sesi502_cname;
156 	LPWSTR sesi502_username;
157 	DWORD sesi502_num_opens;
158 	DWORD sesi502_time;
159 	DWORD sesi502_idle_time;
160 	DWORD sesi502_user_flags;
161 	LPWSTR sesi502_cltype_name;
162 	LPWSTR sesi502_transport;
163 }
164 alias SESSION_INFO_502* PSESSION_INFO_502, LPSESSION_INFO_502;
165 
166 struct CONNECTION_INFO_0 {
167 	DWORD coni0_id;
168 }
169 alias CONNECTION_INFO_0* PCONNECTION_INFO_0, LPCONNECTION_INFO_0;
170 
171 struct CONNECTION_INFO_1 {
172 	DWORD coni1_id;
173 	DWORD coni1_type;
174 	DWORD coni1_num_opens;
175 	DWORD coni1_num_users;
176 	DWORD coni1_time;
177 	LPWSTR coni1_username;
178 	LPWSTR coni1_netname;
179 }
180 alias CONNECTION_INFO_1* PCONNECTION_INFO_1, LPCONNECTION_INFO_1;
181 
182 extern (Windows) {
183 NET_API_STATUS NetShareAdd(LPWSTR,DWORD,PBYTE,PDWORD);
184 NET_API_STATUS NetShareEnum(LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
185 NET_API_STATUS NetShareEnumSticky(LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD resume_handle);
186 NET_API_STATUS NetShareGetInfo(LPWSTR,LPWSTR,DWORD,PBYTE*);
187 NET_API_STATUS NetShareSetInfo(LPWSTR,LPWSTR,DWORD,PBYTE,PDWORD);
188 NET_API_STATUS NetShareDel(LPWSTR,LPWSTR,DWORD);
189 NET_API_STATUS NetShareDelSticky(LPWSTR,LPWSTR,DWORD);
190 NET_API_STATUS NetShareCheck(LPWSTR,LPWSTR,PDWORD);
191 NET_API_STATUS NetSessionEnum(LPWSTR,LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
192 NET_API_STATUS NetSessionDel(LPWSTR,LPWSTR,LPWSTR);
193 NET_API_STATUS NetSessionGetInfo(LPWSTR,LPWSTR,LPWSTR,DWORD,PBYTE*);
194 NET_API_STATUS NetConnectionEnum(LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
195 NET_API_STATUS NetFileClose(LPWSTR,DWORD);
196 NET_API_STATUS NetFileEnum(LPWSTR,LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
197 NET_API_STATUS NetFileGetInfo(LPWSTR,DWORD,DWORD,PBYTE*);
198 }