File Annotation

Not logged in
4e2933c620 2015-04-21        kinaba: /***********************************************************************\
4e2933c620 2015-04-21        kinaba: *                               lmshare.d                               *
4e2933c620 2015-04-21        kinaba: *                                                                       *
4e2933c620 2015-04-21        kinaba: *                       Windows API header module                       *
4e2933c620 2015-04-21        kinaba: *                                                                       *
4e2933c620 2015-04-21        kinaba: *                 Translated from MinGW Windows headers                 *
4e2933c620 2015-04-21        kinaba: *                                                                       *
4e2933c620 2015-04-21        kinaba: *                       Placed into public domain                       *
4e2933c620 2015-04-21        kinaba: \***********************************************************************/
4e2933c620 2015-04-21        kinaba: module win32.lmshare;
9b639cf2d6 2015-05-05        kinaba: pragma(lib, "netapi");
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: import win32.lmcons;
4e2933c620 2015-04-21        kinaba: private import win32.w32api, win32.windef;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: const SHARE_NETNAME_PARMNUM      = 1;
4e2933c620 2015-04-21        kinaba: const SHARE_TYPE_PARMNUM         = 3;
4e2933c620 2015-04-21        kinaba: const SHARE_REMARK_PARMNUM       = 4;
4e2933c620 2015-04-21        kinaba: const SHARE_PERMISSIONS_PARMNUM  = 5;
4e2933c620 2015-04-21        kinaba: const SHARE_MAX_USES_PARMNUM     = 6;
4e2933c620 2015-04-21        kinaba: const SHARE_CURRENT_USES_PARMNUM = 7;
4e2933c620 2015-04-21        kinaba: const SHARE_PATH_PARMNUM         = 8;
4e2933c620 2015-04-21        kinaba: const SHARE_PASSWD_PARMNUM       = 9;
4e2933c620 2015-04-21        kinaba: const SHARE_FILE_SD_PARMNUM      = 501;
4e2933c620 2015-04-21        kinaba: const SHARE_REMARK_INFOLEVEL   = PARMNUM_BASE_INFOLEVEL + SHARE_REMARK_PARMNUM;
4e2933c620 2015-04-21        kinaba: const SHARE_MAX_USES_INFOLEVEL = PARMNUM_BASE_INFOLEVEL + SHARE_MAX_USES_PARMNUM;
4e2933c620 2015-04-21        kinaba: const SHARE_FILE_SD_INFOLEVEL  = PARMNUM_BASE_INFOLEVEL + SHARE_FILE_SD_PARMNUM;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: const SHI1_NUM_ELEMENTS = 4;
4e2933c620 2015-04-21        kinaba: const SHI2_NUM_ELEMENTS = 10;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: const STYPE_DISKTREE = 0;
4e2933c620 2015-04-21        kinaba: const STYPE_PRINTQ   = 1;
4e2933c620 2015-04-21        kinaba: const STYPE_DEVICE   = 2;
4e2933c620 2015-04-21        kinaba: const STYPE_IPC      = 3;
4e2933c620 2015-04-21        kinaba: const STYPE_DFS      = 100;
4e2933c620 2015-04-21        kinaba: const STYPE_SPECIAL  = 0x80000000;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: const DWORD SHI_USES_UNLIMITED = -1;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: const SESS_GUEST = 1;
4e2933c620 2015-04-21        kinaba: const SESS_NOENCRYPTION = 2;
4e2933c620 2015-04-21        kinaba: const SESI1_NUM_ELEMENTS = 8;
4e2933c620 2015-04-21        kinaba: const SESI2_NUM_ELEMENTS = 9;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: const PERM_FILE_READ   = 1;
4e2933c620 2015-04-21        kinaba: const PERM_FILE_WRITE  = 2;
4e2933c620 2015-04-21        kinaba: const PERM_FILE_CREATE = 4;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct FILE_INFO_2 {
4e2933c620 2015-04-21        kinaba: 	DWORD fi2_id;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias FILE_INFO_2* PFILE_INFO_2, LPFILE_INFO_2;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct FILE_INFO_3 {
4e2933c620 2015-04-21        kinaba: 	DWORD fi3_id;
4e2933c620 2015-04-21        kinaba: 	DWORD fi3_permissions;
4e2933c620 2015-04-21        kinaba: 	DWORD fi3_num_locks;
4e2933c620 2015-04-21        kinaba: 	LPTSTR fi3_pathname;
4e2933c620 2015-04-21        kinaba: 	LPTSTR fi3_username;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias FILE_INFO_3* PFILE_INFO_3, LPFILE_INFO_3;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SHARE_INFO_0 {
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi0_netname;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SHARE_INFO_0* PSHARE_INFO_0, LPSHARE_INFO_0;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SHARE_INFO_1 {
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi1_netname;
4e2933c620 2015-04-21        kinaba: 	DWORD shi1_type;
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi1_remark;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SHARE_INFO_1* PSHARE_INFO_1, LPSHARE_INFO_1;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SHARE_INFO_2 {
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi2_netname;
4e2933c620 2015-04-21        kinaba: 	DWORD shi2_type;
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi2_remark;
4e2933c620 2015-04-21        kinaba: 	DWORD shi2_permissions;
4e2933c620 2015-04-21        kinaba: 	DWORD shi2_max_uses;
4e2933c620 2015-04-21        kinaba: 	DWORD shi2_current_uses;
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi2_path;
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi2_passwd;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SHARE_INFO_2* PSHARE_INFO_2, LPSHARE_INFO_2;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SHARE_INFO_502 {
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi502_netname;
4e2933c620 2015-04-21        kinaba: 	DWORD shi502_type;
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi502_remark;
4e2933c620 2015-04-21        kinaba: 	DWORD shi502_permissions;
4e2933c620 2015-04-21        kinaba: 	DWORD shi502_max_uses;
4e2933c620 2015-04-21        kinaba: 	DWORD shi502_current_uses;
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi502_path;
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi502_passwd;
4e2933c620 2015-04-21        kinaba: 	DWORD shi502_reserved;
4e2933c620 2015-04-21        kinaba: 	PSECURITY_DESCRIPTOR shi502_security_descriptor;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SHARE_INFO_502* PSHARE_INFO_502, LPSHARE_INFO_502;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SHARE_INFO_1004 {
4e2933c620 2015-04-21        kinaba: 	LPTSTR shi1004_remark;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SHARE_INFO_1004* PSHARE_INFO_1004, LPSHARE_INFO_1004;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SHARE_INFO_1006 {
4e2933c620 2015-04-21        kinaba: 	DWORD shi1006_max_uses;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SHARE_INFO_1006* PSHARE_INFO_1006, LPSHARE_INFO_1006;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SHARE_INFO_1501 {
4e2933c620 2015-04-21        kinaba: 	DWORD shi1501_reserved;
4e2933c620 2015-04-21        kinaba: 	PSECURITY_DESCRIPTOR shi1501_security_descriptor;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SHARE_INFO_1501* PSHARE_INFO_1501, LPSHARE_INFO_1501;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SESSION_INFO_0 {
4e2933c620 2015-04-21        kinaba: 	LPWSTR sesi0_cname;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SESSION_INFO_0* PSESSION_INFO_0, LPSESSION_INFO_0;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SESSION_INFO_1 {
4e2933c620 2015-04-21        kinaba: 	LPTSTR sesi1_cname;
4e2933c620 2015-04-21        kinaba: 	LPTSTR sesi1_username;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi1_num_opens;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi1_time;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi1_idle_time;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi1_user_flags;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SESSION_INFO_1* PSESSION_INFO_1, LPSESSION_INFO_1;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SESSION_INFO_2 {
4e2933c620 2015-04-21        kinaba: 	LPTSTR sesi2_cname;
4e2933c620 2015-04-21        kinaba: 	LPTSTR sesi2_username;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi2_num_opens;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi2_time;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi2_idle_time;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi2_user_flags;
4e2933c620 2015-04-21        kinaba: 	LPWSTR sesi2_cltype_name;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SESSION_INFO_2* PSESSION_INFO_2, LPSESSION_INFO_2;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SESSION_INFO_10 {
4e2933c620 2015-04-21        kinaba: 	LPWSTR sesi10_cname;
4e2933c620 2015-04-21        kinaba: 	LPWSTR sesi10_username;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi10_time;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi10_idle_time;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SESSION_INFO_10* PSESSION_INFO_10, LPSESSION_INFO_10;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SESSION_INFO_502 {
4e2933c620 2015-04-21        kinaba: 	LPWSTR sesi502_cname;
4e2933c620 2015-04-21        kinaba: 	LPWSTR sesi502_username;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi502_num_opens;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi502_time;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi502_idle_time;
4e2933c620 2015-04-21        kinaba: 	DWORD sesi502_user_flags;
4e2933c620 2015-04-21        kinaba: 	LPWSTR sesi502_cltype_name;
4e2933c620 2015-04-21        kinaba: 	LPWSTR sesi502_transport;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SESSION_INFO_502* PSESSION_INFO_502, LPSESSION_INFO_502;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct CONNECTION_INFO_0 {
4e2933c620 2015-04-21        kinaba: 	DWORD coni0_id;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias CONNECTION_INFO_0* PCONNECTION_INFO_0, LPCONNECTION_INFO_0;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct CONNECTION_INFO_1 {
4e2933c620 2015-04-21        kinaba: 	DWORD coni1_id;
4e2933c620 2015-04-21        kinaba: 	DWORD coni1_type;
4e2933c620 2015-04-21        kinaba: 	DWORD coni1_num_opens;
4e2933c620 2015-04-21        kinaba: 	DWORD coni1_num_users;
4e2933c620 2015-04-21        kinaba: 	DWORD coni1_time;
4e2933c620 2015-04-21        kinaba: 	LPWSTR coni1_username;
4e2933c620 2015-04-21        kinaba: 	LPWSTR coni1_netname;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias CONNECTION_INFO_1* PCONNECTION_INFO_1, LPCONNECTION_INFO_1;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: extern (Windows) {
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetShareAdd(LPWSTR,DWORD,PBYTE,PDWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetShareEnum(LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetShareEnumSticky(LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD resume_handle);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetShareGetInfo(LPWSTR,LPWSTR,DWORD,PBYTE*);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetShareSetInfo(LPWSTR,LPWSTR,DWORD,PBYTE,PDWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetShareDel(LPWSTR,LPWSTR,DWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetShareDelSticky(LPWSTR,LPWSTR,DWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetShareCheck(LPWSTR,LPWSTR,PDWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetSessionEnum(LPWSTR,LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetSessionDel(LPWSTR,LPWSTR,LPWSTR);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetSessionGetInfo(LPWSTR,LPWSTR,LPWSTR,DWORD,PBYTE*);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetConnectionEnum(LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetFileClose(LPWSTR,DWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetFileEnum(LPWSTR,LPWSTR,LPWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,PDWORD);
4e2933c620 2015-04-21        kinaba: NET_API_STATUS NetFileGetInfo(LPWSTR,DWORD,DWORD,PBYTE*);
4e2933c620 2015-04-21        kinaba: }