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