Changeset 172

Show
Ignore:
Timestamp:
12/19/06 20:39:19 (2 years ago)
Author:
smjg
Message:

Polish a few off

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/win32/shellapi.d

    r171 r172  
    5656} 
    5757 
    58 // FIXME: is the value correct? 
    5958static if (WINVER >= 0x501) { 
    6059    const DWORD ABM_SETSTATE = 10; 
  • trunk/win32/snmp.d

    r144 r172  
    1111module win32.snmp; 
    1212 
    13 import win32.windows; 
    14  
     13private import win32.windows; 
     14 
     15// These are not documented on MSDN 
    1516enum { 
    1617    DEFAULT_SNMP_PORT_UDP     =   161, 
     
    6465} 
    6566 
    66 enum { 
     67 
     68enum : AsnInteger { 
    6769    SNMP_ERRORSTATUS_NOERROR, 
    6870    SNMP_ERRORSTATUS_TOOBIG, 
     
    8688} 
    8789 
    88 enum
     90enum : AsnInteger
    8991    SNMP_GENERICTRAP_COLDSTART, 
    9092    SNMP_GENERICTRAP_WARMSTART, 
     
    9698} 
    9799 
     100// These are not documented on MSDN 
    98101enum { 
    99102    SNMP_ACCESS_NONE, 
     
    109112} 
    110113 
    111 enum
     114enum : INT
    112115    SNMP_LOG_SILENT, 
    113116    SNMP_LOG_FATAL, 
     
    118121} 
    119122 
    120 const SNMP_OUTPUT_TO_CONSOLE  =   1; 
    121 const SNMP_OUTPUT_TO_LOGFILE  =   2; 
    122 const SNMP_OUTPUT_TO_EVENTLOG =   4; 
    123 const SNMP_OUTPUT_TO_DEBUGGER =   8; 
    124 const SNMP_MAX_OID_LEN        = 128; 
    125  
    126 enum { 
     123const INT 
     124    SNMP_OUTPUT_TO_CONSOLE  = 1, 
     125    SNMP_OUTPUT_TO_LOGFILE  = 2, 
     126    SNMP_OUTPUT_TO_EVENTLOG = 4, 
     127    SNMP_OUTPUT_TO_DEBUGGER = 8; 
     128 
     129const size_t SNMP_MAX_OID_LEN = 128; 
     130 
     131enum : DWORD { 
    127132    SNMP_MEM_ALLOC_ERROR          =  1, 
    128133    SNMP_BERAPI_INVALID_LENGTH    = 10, 
     
    229234} 
    230235 
    231 // #ifndef SNMPSTRICT 
    232236alias SnmpUtilMemAlloc SNMP_malloc; 
    233237alias SnmpUtilMemFree SNMP_free; 
     
    264268alias AsnCounter32 AsnCounter; 
    265269alias AsnGauge32 AsnGauge; 
    266 // #endif /* SNMPSTRICT */ 
  • trunk/win32/windef.d

    r160 r172  
    5858alias uint    ULONG, DWORD, UINT, COLORREF; 
    5959alias uint*   PULONG, PDWORD, LPDWORD, PUINT, LPUINT; 
    60 alias int     WINBOOL, BOOL, INT, LONG, HFILE
     60alias int     WINBOOL, BOOL, INT, LONG, HFILE, HRESULT
    6161alias int*    PWINBOOL, LPWINBOOL, PBOOL, LPBOOL, PINT, LPINT, LPLONG; 
    6262alias float   FLOAT; 
     
    6666alias UINT_PTR WPARAM; 
    6767alias LONG_PTR LPARAM, LRESULT; 
    68  
    69 alias LONG HRESULT; 
    7068 
    7169alias HANDLE HGLOBAL, HLOCAL, GLOBALHANDLE, LOCALHANDLE, HGDIOBJ, HACCEL, 
     
    116114enum : BOOL { 
    117115    FALSE = 0, 
    118     TRUE = 1, 
     116    TRUE = 1 
    119117} 
  • trunk/win32/windows.d

    r170 r172  
    2727 
    2828// We can't use static if for imports, build gets confused. 
    29 // static if (_WIN32_WINNT_ONLY) import win32.winsvc; 
    3029version (Windows2003) { 
    3130    public import win32.winsvc; 
     
    7170#endif /*  (_WIN32_WINNT >= 0x0400) */ 
    7271+/ 
    73  
  • trunk/win32/winerror.d

    r160 r172  
    16591659    WSA_QOS_RESERVED_PETYPE,                           // = 11031 
    16601660 
    1661  
    16621661    ERROR_IPSEC_QM_POLICY_EXISTS                          = 13000, 
    16631662    ERROR_IPSEC_QM_POLICY_NOT_FOUND, 
     
    18501849} 
    18511850 
    1852 enum : HRESULT
     1851enum : HRESULT
    18531852    S_OK                                   = 0x00000000, 
    18541853    S_FALSE                                = 0x00000001, 
     
    22212220    NTE_FAIL                               = 0x80090020, 
    22222221    NTE_SYS_ERR                            = 0x80090021 
    2223     // NTE_TOKEN_KEYSET_STORAGE  =  ??? 
    22242222} 
    22252223 
     
    22352233    FACILITY_DISPATCH, 
    22362234    FACILITY_STORAGE, 
    2237     FACILITY_ITF, // =   4 
     2235    FACILITY_ITF, // =   4 
    22382236    FACILITY_WIN32    =   7, 
    22392237    FACILITY_WINDOWS  =   8, 
     
    22442242// C Macros 
    22452243 
    2246 bool SUCCEEDED(HRESULT Status) 
    2247 
     2244bool SUCCEEDED(HRESULT Status) { 
    22482245    return Status >= 0; 
    22492246} 
    22502247 
    2251 bool FAILED(HRESULT Status) 
    2252 
     2248bool FAILED(HRESULT Status) { 
    22532249    return Status < 0; 
    22542250} 
    22552251 
    2256 bool IS_ERROR(HRESULT Status) 
    2257 
     2252bool IS_ERROR(HRESULT Status) { 
    22582253    return (Status >>> 31) == SEVERITY_ERROR; 
    22592254} 
    22602255 
    2261 ushort HRESULT_CODE(HRESULT r) 
    2262 
    2263     return cast(ushort)(r & 0xFFFF); 
     2256ushort HRESULT_CODE(HRESULT r) { 
     2257    return cast(ushort) (r & 0xFFFF); 
    22642258} 
    22652259 
    2266 ushort SCODE_CODE(SCODE r) 
    2267 
    2268     return cast(ushort)(r & 0xFFFF); 
     2260ushort SCODE_CODE(SCODE r) { 
     2261    return cast(ushort) (r & 0xFFFF); 
    22692262} 
    22702263 
    2271 ushort HRESULT_FACILITY(HRESULT r) 
    2272 
    2273     return cast(ushort)((r>>16) & 0x1fff); 
     2264ushort HRESULT_FACILITY(HRESULT r) { 
     2265    return cast(ushort) ((r>>16) & 0x1fff); 
    22742266} 
    22752267 
    2276 ushort SCODE_FACILITY(SCODE r) 
    2277 
    2278     return cast(ushort)((r>>16) & 0x1fff); 
     2268ushort SCODE_FACILITY(SCODE r) { 
     2269    return cast(ushort) ((r>>16) & 0x1fff); 
    22792270} 
    22802271 
    2281 ushort HRESULT_SEVERITY(HRESULT r) 
    2282 
    2283     return cast(ushort)((r>>31) & 0x1); 
     2272ushort HRESULT_SEVERITY(HRESULT r) { 
     2273    return cast(ushort) ((r>>31) & 0x1); 
    22842274} 
    22852275 
    2286 ushort SCODE_SEVERITY(SCODE r) 
    2287 
    2288     return cast(ushort)((r>>31) & 0x1); 
     2276ushort SCODE_SEVERITY(SCODE r) { 
     2277    return cast(ushort) ((r>>31) & 0x1); 
    22892278} 
    22902279 
    2291 HRESULT MAKE_HRESULT(bool s, uint f, uint c) 
    2292 
     2280HRESULT MAKE_HRESULT(bool s, uint f, uint c) { 
    22932281    return (s << 31) | (f << 16) | c; 
    22942282} 
    22952283 
    2296 SCODE MAKE_SCODE(bool s, uint f, uint c) 
    2297 
     2284SCODE MAKE_SCODE(bool s, uint f, uint c) { 
    22982285    return (s << 31) | (f << 16) | c; 
    22992286} 
    23002287 
    2301 SCODE GetScode(HRESULT hr) 
    2302 
     2288SCODE GetScode(HRESULT hr) { 
    23032289    return hr; 
    23042290} 
    23052291 
    2306 HRESULT ResultFromScode(SCODE c) 
    2307 
     2292HRESULT ResultFromScode(SCODE c) { 
    23082293    return c; 
    23092294} 
    23102295 
    2311 HRESULT HRESULT_FROM_NT(HRESULT x) 
    2312 
     2296HRESULT HRESULT_FROM_NT(HRESULT x) { 
    23132297    return x | FACILITY_NT_BIT; 
    23142298} 
    23152299 
    2316 HRESULT HRESULT_FROM_WIN32(HRESULT x) 
    2317 
    2318     return  x ? (x & 0x0000FFFF)|(FACILITY_WIN32<<16)|0x80000000 : 0; 
     2300HRESULT HRESULT_FROM_WIN32(HRESULT x) { 
     2301    return  x ? (x & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000 : 0; 
    23192302} 
    23202303 
    2321 HRESULT PropagateResult(HRESULT hrPrevious, SCODE scBase) 
    2322 
     2304HRESULT PropagateResult(HRESULT hrPrevious, SCODE scBase) { 
    23232305    return scBase; 
    23242306} 
  • trunk/win32/winnetwk.d

    r155 r172  
    211211 
    212212struct NETRESOURCEW { 
    213     DWORD dwScope; 
    214     DWORD dwType; 
    215     DWORD dwDisplayType; 
    216     DWORD dwUsage; 
     213    DWORD dwScope; 
     214    DWORD dwType; 
     215    DWORD dwDisplayType; 
     216    DWORD dwUsage; 
    217217    LPWSTR lpLocalName; 
    218218    LPWSTR lpRemoteName; 
     
    242242struct DISCDLGSTRUCTA { 
    243243    DWORD cbStructure; 
    244     HWND hwndOwner; 
     244    HWND hwndOwner; 
    245245    LPSTR lpLocalName; 
    246246    LPSTR lpRemoteName; 
     
    258258alias DISCDLGSTRUCTW* LPDISCDLGSTRUCTW; 
    259259 
    260 struct UNIVERSAL_NAME_INFOA { LPSTR lpUniversalName; } 
     260struct UNIVERSAL_NAME_INFOA { 
     261    LPSTR lpUniversalName; 
     262
    261263alias UNIVERSAL_NAME_INFOA* LPUNIVERSAL_NAME_INFOA; 
    262264 
    263 struct UNIVERSAL_NAME_INFOW { LPWSTR lpUniversalName; } 
     265struct UNIVERSAL_NAME_INFOW { 
     266    LPWSTR lpUniversalName; 
     267
    264268alias UNIVERSAL_NAME_INFOW* LPUNIVERSAL_NAME_INFOW; 
    265269 
  • trunk/win32/winnls.d

    r155 r172  
    1515 
    1616alias DWORD LCTYPE, CALTYPE, CALID, LGRPID, GEOID, GEOTYPE, GEOCLASS; 
    17  
    18 // FIXME: check types of constants 
    1917 
    2018const size_t 
     
    167165enum : DWORD { 
    168166    CP_INSTALLED = 1, 
    169     CP_SUPPORTED = 2 
     167    CP_SUPPORTED 
    170168} 
    171169 
     
    186184    CP_OEMCP, 
    187185    CP_MACCP, 
    188     CP_THREAD_ACP, // =
    189     CP_SYMBOL     = 42, 
    190     CP_UTF7       = 65000, 
    191     CP_UTF8       = 65001 
     186    CP_THREAD_ACP, // =    
     187    CP_SYMBOL         =    42, 
     188    CP_UTF7           = 65000, 
     189    CP_UTF8           = 65001 
    192190} 
    193191 
     
    257255    WC_COMPOSITECHECK = 512; 
    258256 
    259 // The type of these could not be determined from the MSDN site 
    260 enum { 
     257enum : LONG { 
    261258    CTRY_DEFAULT            =   0, 
    262259    CTRY_DOMINICAN_REPUBLIC =   1, 
     
    374371 
    375372enum : CALTYPE { 
    376     CAL_ICALINTVALUE = 1, 
     373    CAL_ICALINTVALUE          = 1, 
    377374    CAL_SCALNAME, 
    378375    CAL_IYEAROFFSETRANGE, 
     
    424421 
    425422enum : CALTYPE { 
    426     CAL_GREGORIAN = 1, 
     423    CAL_GREGORIAN                = 1, 
    427424    CAL_GREGORIAN_US, 
    428425    CAL_JAPAN, 
     
    607604 
    608605struct NUMBERFMTA { 
    609     UINT NumDigits; 
    610     UINT LeadingZero; 
    611     UINT Grouping; 
     606    UINT NumDigits; 
     607    UINT LeadingZero; 
     608    UINT Grouping; 
    612609    LPSTR lpDecimalSep; 
    613610    LPSTR lpThousandSep; 
    614     UINT NegativeOrder; 
     611    UINT NegativeOrder; 
    615612} 
    616613alias NUMBERFMTA* LPNUMBERFMTA; 
  • trunk/win32/winreg.d

    r155 r172  
    1212pragma(lib, "advapi32.lib"); 
    1313 
    14 private import win32.winbase, win32.windef; 
     14private import win32.w32api, win32.winbase, win32.windef; 
    1515 
    1616const HKEY 
     
    3434 
    3535enum : DWORD { 
    36     REG_NONE  = 0, 
     36    REG_NONE                       = 0, 
    3737    REG_SZ, 
    3838    REG_EXPAND_SZ, 
    3939    REG_BINARY, 
    4040    REG_DWORD_LITTLE_ENDIAN, 
    41     REG_DWORD = REG_DWORD_LITTLE_ENDIAN, 
     41    REG_DWORD                      = REG_DWORD_LITTLE_ENDIAN, 
    4242    REG_DWORD_BIG_ENDIAN, 
    4343    REG_LINK, 
     
    4747    REG_RESOURCE_REQUIREMENTS_LIST, 
    4848    REG_QWORD_LITTLE_ENDIAN, 
    49     REG_QWORD = REG_QWORD_LITTLE_ENDIAN 
     49    REG_QWORD                      = REG_QWORD_LITTLE_ENDIAN 
    5050} 
    5151 
     
    7575 
    7676extern (Windows) { 
    77     BOOL AbortSystemShutdownA(LPCSTR); 
    78     BOOL AbortSystemShutdownW(LPCWSTR); 
    79     BOOL InitiateSystemShutdownA(LPSTR, LPSTR, DWORD, BOOL, BOOL); 
    80     BOOL InitiateSystemShutdownW(LPWSTR, LPWSTR, DWORD, BOOL, BOOL); 
    8177    LONG RegCloseKey(HKEY); 
    8278    LONG RegConnectRegistryA(LPCSTR, HKEY, PHKEY); 
     
    9995      PDWORD); 
    10096    LONG RegFlushKey(HKEY); 
    101     LONG RegGetKeySecurity(HKEY, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR, 
    102       PDWORD); 
    10397    LONG RegLoadKeyA(HKEY, LPCSTR, LPCSTR); 
    10498    LONG RegLoadKeyW(HKEY, LPCWSTR, LPCWSTR); 
    105     LONG RegNotifyChangeKeyValue(HKEY, BOOL, DWORD, HANDLE, BOOL); 
    10699    LONG RegOpenKeyExA(HKEY, LPCSTR, DWORD, REGSAM, PHKEY); 
    107100    LONG RegOpenKeyExW(HKEY, LPCWSTR, DWORD, REGSAM, PHKEY); 
     
    116109    LONG RegReplaceKeyA(HKEY, LPCSTR, LPCSTR, LPCSTR); 
    117110    LONG RegReplaceKeyW(HKEY, LPCWSTR, LPCWSTR, LPCWSTR); 
    118     LONG RegRestoreKeyA(HKEY, LPCSTR, DWORD); 
    119     LONG RegRestoreKeyW(HKEY, LPCWSTR, DWORD); 
    120111    LONG RegSaveKeyA(HKEY, LPCSTR, LPSECURITY_ATTRIBUTES); 
    121112    LONG RegSaveKeyW(HKEY, LPCWSTR, LPSECURITY_ATTRIBUTES); 
     
    125116    LONG RegUnLoadKeyA(HKEY, LPCSTR); 
    126117    LONG RegUnLoadKeyW(HKEY, LPCWSTR); 
     118 
     119    static if (_WIN32_WINDOWS >= 0x410) { 
     120        LONG RegNotifyChangeKeyValue(HKEY, BOOL, DWORD, HANDLE, BOOL); 
     121    } 
     122 
     123    static if (_WIN32_WINNT_ONLY) { 
     124        BOOL AbortSystemShutdownA(LPCSTR); 
     125        BOOL AbortSystemShutdownW(LPCWSTR); 
     126        BOOL InitiateSystemShutdownA(LPSTR, LPSTR, DWORD, BOOL, BOOL); 
     127        BOOL InitiateSystemShutdownW(LPWSTR, LPWSTR, DWORD, BOOL, BOOL); 
     128        LONG RegGetKeySecurity(HKEY, SECURITY_INFORMATION, 
     129          PSECURITY_DESCRIPTOR, PDWORD); 
     130        LONG RegRestoreKeyA(HKEY, LPCSTR, DWORD); 
     131        LONG RegRestoreKeyW(HKEY, LPCWSTR, DWORD); 
     132        LONG RegSetKeySecurity(HKEY, SECURITY_INFORMATION, 
     133          PSECURITY_DESCRIPTOR); 
     134 
     135        static if (_WIN32_WINNT >= 0x500) { 
     136            LONG RegDisablePredefinedCache(); 
     137            LONG RegOpenCurrentUser(REGSAM, PHKEY); 
     138            LONG RegOpenUserClassesRoot(HANDLE, DWORD, REGSAM, PHKEY); 
     139        } 
     140 
     141        static if (_WIN32_WINNT >= 0x501) { 
     142            LONG RegSaveKeyExA(HKEY, LPCSTR, LPSECURITY_ATTRIBUTES, DWORD); 
     143            LONG RegSaveKeyExW(HKEY, LPCWSTR, LPSECURITY_ATTRIBUTES, DWORD); 
     144        } 
     145    } 
     146 
    127147    deprecated { 
    128148        LONG RegCreateKeyA(HKEY, LPCSTR, PHKEY); 
     
    141161version (Unicode) { 
    142162    alias VALENTW VALENT; 
    143     alias AbortSystemShutdownW AbortSystemShutdown; 
    144     alias InitiateSystemShutdownW InitiateSystemShutdown; 
    145163    alias RegConnectRegistryW RegConnectRegistry; 
    146164    alias RegCreateKeyExW RegCreateKeyEx; 
     
    155173    alias RegQueryValueExW RegQueryValueEx; 
    156174    alias RegReplaceKeyW RegReplaceKey; 
    157     alias RegRestoreKeyW RegRestoreKey; 
    158175    alias RegSaveKeyW RegSaveKey; 
    159176    alias RegSetValueExW RegSetValueEx; 
    160177    alias RegUnLoadKeyW RegUnLoadKey; 
     178    static if (_WIN32_WINNT_ONLY) { 
     179        alias AbortSystemShutdownW AbortSystemShutdown; 
     180        alias InitiateSystemShutdownW InitiateSystemShutdown; 
     181        alias RegRestoreKeyW RegRestoreKey; 
     182        static if (_WIN32_WINNT >= 0x501) { 
     183            alias RegSaveKeyExA RegSaveKeyEx; 
     184        } 
     185    } 
    161186    deprecated { 
    162187        alias RegCreateKeyW RegCreateKey; 
     
    168193} else { 
    169194    alias VALENTA VALENT; 
    170     alias AbortSystemShutdownA AbortSystemShutdown; 
    171     alias InitiateSystemShutdownA InitiateSystemShutdown; 
    172195    alias RegConnectRegistryA RegConnectRegistry; 
    173196    alias RegCreateKeyExA RegCreateKeyEx; 
     
    182205    alias RegQueryValueExA RegQueryValueEx; 
    183206    alias RegReplaceKeyA RegReplaceKey; 
    184     alias RegRestoreKeyA RegRestoreKey; 
    185207    alias RegSaveKeyA RegSaveKey; 
    186208    alias RegSetValueExA RegSetValueEx; 
    187209    alias RegUnLoadKeyA RegUnLoadKey; 
     210    static if (_WIN32_WINNT_ONLY) { 
     211        alias AbortSystemShutdownA AbortSystemShutdown; 
     212        alias InitiateSystemShutdownA InitiateSystemShutdown; 
     213        alias RegRestoreKeyW RegRestoreKey; 
     214        static if (_WIN32_WINNT >= 0x501) { 
     215            alias RegSaveKeyExA RegSaveKeyEx; 
     216        } 
     217    } 
    188218    deprecated { 
    189219        alias RegCreateKeyA RegCreateKey;