File Annotation

Not logged in
4e2933c620 2015-04-21        kinaba: /***********************************************************************\
4e2933c620 2015-04-21        kinaba: *                                lmsvc.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.lmsvc;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: // FIXME: Is this file deprecated? All of the functions are only for Win16.
4e2933c620 2015-04-21        kinaba: /**
4e2933c620 2015-04-21        kinaba:   Changes relative to MinGW:
4e2933c620 2015-04-21        kinaba:   lmsname is not imported publicly (instead, win32.lm imports it directly).
4e2933c620 2015-04-21        kinaba: */
4e2933c620 2015-04-21        kinaba: // TODO: 5 macros
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: private import win32.lmcons, win32.lmsname, win32.windef;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: const TCHAR[] SERVICE_DOS_ENCRYPTION = "ENCRYPT";
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: const SERVICE_UNINSTALLED=0;
4e2933c620 2015-04-21        kinaba: const SERVICE_INSTALL_PENDING=1;
4e2933c620 2015-04-21        kinaba: const SERVICE_UNINSTALL_PENDING=2;
4e2933c620 2015-04-21        kinaba: const SERVICE_INSTALLED=3;
4e2933c620 2015-04-21        kinaba: const SERVICE_INSTALL_STATE=3;
4e2933c620 2015-04-21        kinaba: const SERVICE_PAUSE_STATE=18;
4e2933c620 2015-04-21        kinaba: const LM20_SERVICE_ACTIVE=0;
4e2933c620 2015-04-21        kinaba: const LM20_SERVICE_CONTINUE_PENDING=4;
4e2933c620 2015-04-21        kinaba: const LM20_SERVICE_PAUSE_PENDING=8;
4e2933c620 2015-04-21        kinaba: const LM20_SERVICE_PAUSED=18;
4e2933c620 2015-04-21        kinaba: const SERVICE_NOT_UNINSTALLABLE=0;
4e2933c620 2015-04-21        kinaba: const SERVICE_UNINSTALLABLE=16;
4e2933c620 2015-04-21        kinaba: const SERVICE_NOT_PAUSABLE=0;
4e2933c620 2015-04-21        kinaba: const SERVICE_PAUSABLE=32;
4e2933c620 2015-04-21        kinaba: const SERVICE_REDIR_PAUSED=0x700;
4e2933c620 2015-04-21        kinaba: const SERVICE_REDIR_DISK_PAUSED=256;
4e2933c620 2015-04-21        kinaba: const SERVICE_REDIR_PRINT_PAUSED=512;
4e2933c620 2015-04-21        kinaba: const SERVICE_REDIR_COMM_PAUSED=1024;
4e2933c620 2015-04-21        kinaba: const SERVICE_CTRL_INTERROGATE=0;
4e2933c620 2015-04-21        kinaba: const SERVICE_CTRL_PAUSE=1;
4e2933c620 2015-04-21        kinaba: const SERVICE_CTRL_CONTINUE=2;
4e2933c620 2015-04-21        kinaba: const SERVICE_CTRL_UNINSTALL=3;
4e2933c620 2015-04-21        kinaba: const SERVICE_CTRL_REDIR_DISK=1;
4e2933c620 2015-04-21        kinaba: const SERVICE_CTRL_REDIR_PRINT=2;
4e2933c620 2015-04-21        kinaba: const SERVICE_CTRL_REDIR_COMM=4;
4e2933c620 2015-04-21        kinaba: const SERVICE_IP_NO_HINT=0;
4e2933c620 2015-04-21        kinaba: const SERVICE_CCP_NO_HINT=0;
4e2933c620 2015-04-21        kinaba: const SERVICE_IP_QUERY_HINT=0x10000;
4e2933c620 2015-04-21        kinaba: const SERVICE_CCP_QUERY_HINT=0x10000;
4e2933c620 2015-04-21        kinaba: const SERVICE_IP_CHKPT_NUM=255;
4e2933c620 2015-04-21        kinaba: const SERVICE_CCP_CHKPT_NUM=255;
4e2933c620 2015-04-21        kinaba: const SERVICE_IP_WAIT_TIME=0xFF00;
4e2933c620 2015-04-21        kinaba: const SERVICE_CCP_WAIT_TIME=0xFF00;
4e2933c620 2015-04-21        kinaba: const SERVICE_IP_WAITTIME_SHIFT=8;
4e2933c620 2015-04-21        kinaba: const SERVICE_NTIP_WAITTIME_SHIFT=12;
4e2933c620 2015-04-21        kinaba: const UPPER_HINT_MASK=0xFF00;
4e2933c620 2015-04-21        kinaba: const LOWER_HINT_MASK=255;
4e2933c620 2015-04-21        kinaba: const UPPER_GET_HINT_MASK=0xFF00000;
4e2933c620 2015-04-21        kinaba: const LOWER_GET_HINT_MASK=0xFF00;
4e2933c620 2015-04-21        kinaba: const SERVICE_NT_MAXTIME=0xFFFF;
4e2933c620 2015-04-21        kinaba: const SERVICE_RESRV_MASK=0x1FFFF;
4e2933c620 2015-04-21        kinaba: const SERVICE_MAXTIME=255;
4e2933c620 2015-04-21        kinaba: const SERVICE_BASE=3050;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_NORMAL=0;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_BADPARMVAL = SERVICE_BASE+1;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_MISSPARM = SERVICE_BASE+2;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_UNKPARM = SERVICE_BASE+3;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_RESOURCE = SERVICE_BASE+4;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_CONFIG = SERVICE_BASE+5;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_SYSTEM = SERVICE_BASE+6;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_INTERNAL = SERVICE_BASE+7;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_AMBIGPARM = SERVICE_BASE+8;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_DUPPARM = SERVICE_BASE+9;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_KILL = SERVICE_BASE+10;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_EXEC = SERVICE_BASE+11;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_SUBSERV = SERVICE_BASE+12;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_CONFLPARM = SERVICE_BASE+13;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_FILE = SERVICE_BASE+14;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_NULL=0;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_MEMORY = SERVICE_BASE+20;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_DISK = SERVICE_BASE+21;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_THREADS = SERVICE_BASE+22;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_PROCESSES = SERVICE_BASE+23;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_SECURITY = SERVICE_BASE+24;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_LANROOT = SERVICE_BASE+25;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_REDIR = SERVICE_BASE+26;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_SERVER = SERVICE_BASE+27;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_SEC_FILE_ERR = SERVICE_BASE+28;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_FILES = SERVICE_BASE+29;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_LOGS = SERVICE_BASE+30;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_LANGROUP = SERVICE_BASE+31;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_MSGNAME = SERVICE_BASE+32;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_ANNOUNCE = SERVICE_BASE+33;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_UAS = SERVICE_BASE+34;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_SERVER_SEC_ERR = SERVICE_BASE+35;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_WKSTA = SERVICE_BASE+37;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_ERRLOG = SERVICE_BASE+38;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_FILE_UW = SERVICE_BASE+39;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_ADDPAK = SERVICE_BASE+40;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_LAZY = SERVICE_BASE+41;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_UAS_MACHINE_ACCT = SERVICE_BASE+42;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_UAS_SERVERS_NMEMB = SERVICE_BASE+43;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_UAS_SERVERS_NOGRP = SERVICE_BASE+44;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_UAS_INVALID_ROLE = SERVICE_BASE+45;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_NETLOGON_NO_DC = SERVICE_BASE+46;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_NETLOGON_DC_CFLCT = SERVICE_BASE+47;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_NETLOGON_AUTH = SERVICE_BASE+48;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_UAS_PROLOG = SERVICE_BASE+49;
4e2933c620 2015-04-21        kinaba: const SERVICE2_BASE=5600;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_NETLOGON_MPATH = SERVICE2_BASE+0;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_LSA_MACHINE_ACCT = SERVICE2_BASE+1;
4e2933c620 2015-04-21        kinaba: const SERVICE_UIC_M_DATABASE_ERROR = SERVICE2_BASE+2;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SERVICE_INFO_0 {
4e2933c620 2015-04-21        kinaba: 	LPWSTR svci0_name;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SERVICE_INFO_0* PSERVICE_INFO_0, LPSERVICE_INFO_0;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SERVICE_INFO_1 {
4e2933c620 2015-04-21        kinaba: 	LPWSTR svci1_name;
4e2933c620 2015-04-21        kinaba: 	DWORD svci1_status;
4e2933c620 2015-04-21        kinaba: 	DWORD svci1_code;
4e2933c620 2015-04-21        kinaba: 	DWORD svci1_pid;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SERVICE_INFO_1* PSERVICE_INFO_1, LPSERVICE_INFO_1;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: struct SERVICE_INFO_2 {
4e2933c620 2015-04-21        kinaba: 	LPWSTR svci2_name;
4e2933c620 2015-04-21        kinaba: 	DWORD svci2_status;
4e2933c620 2015-04-21        kinaba: 	DWORD svci2_code;
4e2933c620 2015-04-21        kinaba: 	DWORD svci2_pid;
4e2933c620 2015-04-21        kinaba: 	LPWSTR svci2_text;
4e2933c620 2015-04-21        kinaba: 	DWORD svci2_specific_error;
4e2933c620 2015-04-21        kinaba: 	LPWSTR svci2_display_name;
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: alias SERVICE_INFO_2* PSERVICE_INFO_2, LPSERVICE_INFO_2;
4e2933c620 2015-04-21        kinaba: 
4e2933c620 2015-04-21        kinaba: extern (Windows) {
4e2933c620 2015-04-21        kinaba: 	deprecated {
4e2933c620 2015-04-21        kinaba: 		NET_API_STATUS NetServiceControl(LPCWSTR, LPCWSTR, DWORD, DWORD,
4e2933c620 2015-04-21        kinaba: 		  PBYTE*);
4e2933c620 2015-04-21        kinaba: 		NET_API_STATUS NetServiceEnum(LPCWSTR, DWORD, PBYTE*, DWORD, PDWORD,
4e2933c620 2015-04-21        kinaba: 		  PDWORD, PDWORD);
4e2933c620 2015-04-21        kinaba: 		NET_API_STATUS NetServiceGetInfo(LPCWSTR, LPCWSTR, DWORD, PBYTE*);
4e2933c620 2015-04-21        kinaba: 		NET_API_STATUS NetServiceInstall(LPCWSTR, LPCWSTR, DWORD, LPCWSTR*,
4e2933c620 2015-04-21        kinaba: 		  PBYTE*);
4e2933c620 2015-04-21        kinaba: 	}
4e2933c620 2015-04-21        kinaba: }
4e2933c620 2015-04-21        kinaba: //MACRO #define SERVICE_IP_CODE(t, n) ((long)SERVICE_IP_QUERY_HINT|(long)(n|(t<<SERVICE_IP_WAITTIME_SHIFT)))
4e2933c620 2015-04-21        kinaba: //MACRO #define SERVICE_CCP_CODE(t, n) ((long)SERVICE_CCP_QUERY_HINT|(long)(n|(t<<SERVICE_IP_WAITTIME_SHIFT)))
4e2933c620 2015-04-21        kinaba: //MACRO #define SERVICE_UIC_CODE(c, m) ((long)(((long)c<<16)|(long)(USHORT)m))
4e2933c620 2015-04-21        kinaba: //MACRO #define SERVICE_NT_CCP_CODE(t, n) (((long)SERVICE_CCP_QUERY_HINT)|((long)(n))|(((t)&LOWER_HINT_MASK)<<SERVICE_IP_WAITTIME_SHIFT)|(((t)&UPPER_HINT_MASK)<<SERVICE_NTIP_WAITTIME_SHIFT))
4e2933c620 2015-04-21        kinaba: //MACRO #define SERVICE_NT_WAIT_GET(c) ((((c)&UPPER_GET_HINT_MASK)>>SERVICE_NTIP_WAITTIME_SHIFT)|(((c)&LOWER_GET_HINT_MASK)>>SERVICE_IP_WAITTIME_SHIFT))