1 /***********************************************************************\ 2 * lmsvc.d * 3 * * 4 * Windows API header module * 5 * * 6 * Translated from MinGW Windows headers * 7 * * 8 * Placed into public domain * 9 \***********************************************************************/ 10 module win32.lmsvc; 11 12 // FIXME: Is this file deprecated? All of the functions are only for Win16. 13 /** 14 Changes relative to MinGW: 15 lmsname is not imported publicly (instead, win32.lm imports it directly). 16 */ 17 // TODO: 5 macros 18 19 private import win32.lmcons, win32.lmsname, win32.windef; 20 21 const TCHAR[] SERVICE_DOS_ENCRYPTION = "ENCRYPT"; 22 23 const SERVICE_UNINSTALLED=0; 24 const SERVICE_INSTALL_PENDING=1; 25 const SERVICE_UNINSTALL_PENDING=2; 26 const SERVICE_INSTALLED=3; 27 const SERVICE_INSTALL_STATE=3; 28 const SERVICE_PAUSE_STATE=18; 29 const LM20_SERVICE_ACTIVE=0; 30 const LM20_SERVICE_CONTINUE_PENDING=4; 31 const LM20_SERVICE_PAUSE_PENDING=8; 32 const LM20_SERVICE_PAUSED=18; 33 const SERVICE_NOT_UNINSTALLABLE=0; 34 const SERVICE_UNINSTALLABLE=16; 35 const SERVICE_NOT_PAUSABLE=0; 36 const SERVICE_PAUSABLE=32; 37 const SERVICE_REDIR_PAUSED=0x700; 38 const SERVICE_REDIR_DISK_PAUSED=256; 39 const SERVICE_REDIR_PRINT_PAUSED=512; 40 const SERVICE_REDIR_COMM_PAUSED=1024; 41 const SERVICE_CTRL_INTERROGATE=0; 42 const SERVICE_CTRL_PAUSE=1; 43 const SERVICE_CTRL_CONTINUE=2; 44 const SERVICE_CTRL_UNINSTALL=3; 45 const SERVICE_CTRL_REDIR_DISK=1; 46 const SERVICE_CTRL_REDIR_PRINT=2; 47 const SERVICE_CTRL_REDIR_COMM=4; 48 const SERVICE_IP_NO_HINT=0; 49 const SERVICE_CCP_NO_HINT=0; 50 const SERVICE_IP_QUERY_HINT=0x10000; 51 const SERVICE_CCP_QUERY_HINT=0x10000; 52 const SERVICE_IP_CHKPT_NUM=255; 53 const SERVICE_CCP_CHKPT_NUM=255; 54 const SERVICE_IP_WAIT_TIME=0xFF00; 55 const SERVICE_CCP_WAIT_TIME=0xFF00; 56 const SERVICE_IP_WAITTIME_SHIFT=8; 57 const SERVICE_NTIP_WAITTIME_SHIFT=12; 58 const UPPER_HINT_MASK=0xFF00; 59 const LOWER_HINT_MASK=255; 60 const UPPER_GET_HINT_MASK=0xFF00000; 61 const LOWER_GET_HINT_MASK=0xFF00; 62 const SERVICE_NT_MAXTIME=0xFFFF; 63 const SERVICE_RESRV_MASK=0x1FFFF; 64 const SERVICE_MAXTIME=255; 65 const SERVICE_BASE=3050; 66 const SERVICE_UIC_NORMAL=0; 67 68 const SERVICE_UIC_BADPARMVAL = SERVICE_BASE+1; 69 const SERVICE_UIC_MISSPARM = SERVICE_BASE+2; 70 const SERVICE_UIC_UNKPARM = SERVICE_BASE+3; 71 const SERVICE_UIC_RESOURCE = SERVICE_BASE+4; 72 const SERVICE_UIC_CONFIG = SERVICE_BASE+5; 73 const SERVICE_UIC_SYSTEM = SERVICE_BASE+6; 74 const SERVICE_UIC_INTERNAL = SERVICE_BASE+7; 75 const SERVICE_UIC_AMBIGPARM = SERVICE_BASE+8; 76 const SERVICE_UIC_DUPPARM = SERVICE_BASE+9; 77 const SERVICE_UIC_KILL = SERVICE_BASE+10; 78 const SERVICE_UIC_EXEC = SERVICE_BASE+11; 79 const SERVICE_UIC_SUBSERV = SERVICE_BASE+12; 80 const SERVICE_UIC_CONFLPARM = SERVICE_BASE+13; 81 const SERVICE_UIC_FILE = SERVICE_BASE+14; 82 const SERVICE_UIC_M_NULL=0; 83 const SERVICE_UIC_M_MEMORY = SERVICE_BASE+20; 84 const SERVICE_UIC_M_DISK = SERVICE_BASE+21; 85 const SERVICE_UIC_M_THREADS = SERVICE_BASE+22; 86 const SERVICE_UIC_M_PROCESSES = SERVICE_BASE+23; 87 const SERVICE_UIC_M_SECURITY = SERVICE_BASE+24; 88 const SERVICE_UIC_M_LANROOT = SERVICE_BASE+25; 89 const SERVICE_UIC_M_REDIR = SERVICE_BASE+26; 90 const SERVICE_UIC_M_SERVER = SERVICE_BASE+27; 91 const SERVICE_UIC_M_SEC_FILE_ERR = SERVICE_BASE+28; 92 const SERVICE_UIC_M_FILES = SERVICE_BASE+29; 93 const SERVICE_UIC_M_LOGS = SERVICE_BASE+30; 94 const SERVICE_UIC_M_LANGROUP = SERVICE_BASE+31; 95 const SERVICE_UIC_M_MSGNAME = SERVICE_BASE+32; 96 const SERVICE_UIC_M_ANNOUNCE = SERVICE_BASE+33; 97 const SERVICE_UIC_M_UAS = SERVICE_BASE+34; 98 const SERVICE_UIC_M_SERVER_SEC_ERR = SERVICE_BASE+35; 99 const SERVICE_UIC_M_WKSTA = SERVICE_BASE+37; 100 const SERVICE_UIC_M_ERRLOG = SERVICE_BASE+38; 101 const SERVICE_UIC_M_FILE_UW = SERVICE_BASE+39; 102 const SERVICE_UIC_M_ADDPAK = SERVICE_BASE+40; 103 const SERVICE_UIC_M_LAZY = SERVICE_BASE+41; 104 const SERVICE_UIC_M_UAS_MACHINE_ACCT = SERVICE_BASE+42; 105 const SERVICE_UIC_M_UAS_SERVERS_NMEMB = SERVICE_BASE+43; 106 const SERVICE_UIC_M_UAS_SERVERS_NOGRP = SERVICE_BASE+44; 107 const SERVICE_UIC_M_UAS_INVALID_ROLE = SERVICE_BASE+45; 108 const SERVICE_UIC_M_NETLOGON_NO_DC = SERVICE_BASE+46; 109 const SERVICE_UIC_M_NETLOGON_DC_CFLCT = SERVICE_BASE+47; 110 const SERVICE_UIC_M_NETLOGON_AUTH = SERVICE_BASE+48; 111 const SERVICE_UIC_M_UAS_PROLOG = SERVICE_BASE+49; 112 const SERVICE2_BASE=5600; 113 const SERVICE_UIC_M_NETLOGON_MPATH = SERVICE2_BASE+0; 114 const SERVICE_UIC_M_LSA_MACHINE_ACCT = SERVICE2_BASE+1; 115 const SERVICE_UIC_M_DATABASE_ERROR = SERVICE2_BASE+2; 116 117 struct SERVICE_INFO_0 { 118 LPWSTR svci0_name; 119 } 120 alias SERVICE_INFO_0* PSERVICE_INFO_0, LPSERVICE_INFO_0; 121 122 struct SERVICE_INFO_1 { 123 LPWSTR svci1_name; 124 DWORD svci1_status; 125 DWORD svci1_code; 126 DWORD svci1_pid; 127 } 128 alias SERVICE_INFO_1* PSERVICE_INFO_1, LPSERVICE_INFO_1; 129 130 struct SERVICE_INFO_2 { 131 LPWSTR svci2_name; 132 DWORD svci2_status; 133 DWORD svci2_code; 134 DWORD svci2_pid; 135 LPWSTR svci2_text; 136 DWORD svci2_specific_error; 137 LPWSTR svci2_display_name; 138 } 139 alias SERVICE_INFO_2* PSERVICE_INFO_2, LPSERVICE_INFO_2; 140 141 extern (Windows) { 142 deprecated { 143 NET_API_STATUS NetServiceControl(LPCWSTR, LPCWSTR, DWORD, DWORD, 144 PBYTE*); 145 NET_API_STATUS NetServiceEnum(LPCWSTR, DWORD, PBYTE*, DWORD, PDWORD, 146 PDWORD, PDWORD); 147 NET_API_STATUS NetServiceGetInfo(LPCWSTR, LPCWSTR, DWORD, PBYTE*); 148 NET_API_STATUS NetServiceInstall(LPCWSTR, LPCWSTR, DWORD, LPCWSTR*, 149 PBYTE*); 150 } 151 } 152 //MACRO #define SERVICE_IP_CODE(t, n) ((long)SERVICE_IP_QUERY_HINT|(long)(n|(t<<SERVICE_IP_WAITTIME_SHIFT))) 153 //MACRO #define SERVICE_CCP_CODE(t, n) ((long)SERVICE_CCP_QUERY_HINT|(long)(n|(t<<SERVICE_IP_WAITTIME_SHIFT))) 154 //MACRO #define SERVICE_UIC_CODE(c, m) ((long)(((long)c<<16)|(long)(USHORT)m)) 155 //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)) 156 //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))