preparations for more Nimble packages; clear licensing; fixes #2949

This commit is contained in:
Araq
2015-06-20 23:24:21 +02:00
parent e74012b396
commit 87f65f5e72
70 changed files with 1061 additions and 54085 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,236 +0,0 @@
#
#
# Nim's Runtime Library
# (c) Copyright 2006 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# NetBIOS 3.0 interface unit
# This module contains the definitions for portable NetBIOS 3.0 support.
{.deadCodeElim: on.}
import # Data structure templates
windows
const
NCBNAMSZ* = 16 # absolute length of a net name
MAX_LANA* = 254 # lana's in range 0 to MAX_LANA inclusive
type # Network Control Block
PNCB* = ptr NCB
NCBPostProc* = proc (P: PNCB) {.stdcall.}
NCB* {.final.} = object # Structure returned to the NCB command NCBASTAT is ADAPTER_STATUS followed
# by an array of NAME_BUFFER structures.
ncb_command*: char # command code
ncb_retcode*: char # return code
ncb_lsn*: char # local session number
ncb_num*: char # number of our network name
ncb_buffer*: cstring # address of message buffer
ncb_length*: int16 # size of message buffer
ncb_callname*: array[0..NCBNAMSZ - 1, char] # blank-padded name of remote
ncb_name*: array[0..NCBNAMSZ - 1, char] # our blank-padded netname
ncb_rto*: char # rcv timeout/retry count
ncb_sto*: char # send timeout/sys timeout
ncb_post*: NCBPostProc # POST routine address
ncb_lana_num*: char # lana (adapter) number
ncb_cmd_cplt*: char # 0xff => commmand pending
ncb_reserve*: array[0..9, char] # reserved, used by BIOS
ncb_event*: Handle # HANDLE to Win32 event which
# will be set to the signalled
# state when an ASYNCH command
# completes
PAdapterStatus* = ptr AdapterStatus
AdapterStatus* {.final.} = object
adapter_address*: array[0..5, char]
rev_major*: char
reserved0*: char
adapter_type*: char
rev_minor*: char
duration*: int16
frmr_recv*: int16
frmr_xmit*: int16
iframe_recv_err*: int16
xmit_aborts*: int16
xmit_success*: DWORD
recv_success*: DWORD
iframe_xmit_err*: int16
recv_buff_unavail*: int16
t1_timeouts*: int16
ti_timeouts*: int16
reserved1*: DWORD
free_ncbs*: int16
max_cfg_ncbs*: int16
max_ncbs*: int16
xmit_buf_unavail*: int16
max_dgram_size*: int16
pending_sess*: int16
max_cfg_sess*: int16
max_sess*: int16
max_sess_pkt_size*: int16
name_count*: int16
PNameBuffer* = ptr NameBuffer
NameBuffer* {.final.} = object
name*: array[0..NCBNAMSZ - 1, char]
name_num*: char
name_flags*: char
{.deprecated: [TNCB: NCB, TNCBPostProc: NCBPostProc,
TAdapterStatus: AdapterStatus, TNameBuffer: NameBuffer].}
const # values for name_flags bits.
NAME_FLAGS_MASK* = 0x00000087
GROUP_NAME* = 0x00000080
UNIQUE_NAME* = 0x00000000
REGISTERING* = 0x00000000
REGISTERED* = 0x00000004
DEREGISTERED* = 0x00000005
DUPLICATE* = 0x00000006
DUPLICATE_DEREG* = 0x00000007
type # Structure returned to the NCB command NCBSSTAT is SESSION_HEADER followed
# by an array of SESSION_BUFFER structures. If the NCB_NAME starts with an
# asterisk then an array of these structures is returned containing the
# status for all names.
PSessionHeader* = ptr SessionHeader
SessionHeader* {.final.} = object
sess_name*: char
num_sess*: char
rcv_dg_outstanding*: char
rcv_any_outstanding*: char
PSessionBuffer* = ptr SessionBuffer
SessionBuffer* {.final.} = object
lsn*: char
state*: char
local_name*: array[0..NCBNAMSZ - 1, char]
remote_name*: array[0..NCBNAMSZ - 1, char]
rcvs_outstanding*: char
sends_outstanding*: char
{.deprecated: [TSessionHeader: SessionHeader, TSessionBuffer: SessionBuffer].}
const # Values for state
LISTEN_OUTSTANDING* = 0x00000001
CALL_PENDING* = 0x00000002
SESSION_ESTABLISHED* = 0x00000003
HANGUP_PENDING* = 0x00000004
HANGUP_COMPLETE* = 0x00000005
SESSION_ABORTED* = 0x00000006
type # Structure returned to the NCB command NCBENUM.
# On a system containing lana's 0, 2 and 3, a structure with
# length =3, lana[0]=0, lana[1]=2 and lana[2]=3 will be returned.
PLanaEnum* = ptr TLanaEnum
TLanaEnum* {.final.} = object # Structure returned to the NCB command NCBFINDNAME is FIND_NAME_HEADER followed
# by an array of FIND_NAME_BUFFER structures.
len*: char # Number of valid entries in lana[]
lana*: array[0..MAX_LANA, char]
PFindNameHeader* = ptr FindNameHeader
FindNameHeader* {.final.} = object
node_count*: int16
reserved*: char
unique_group*: char
PFindNameBuffer* = ptr FindNameBuffer
FindNameBuffer* {.final.} = object # Structure provided with NCBACTION. The purpose of NCBACTION is to provide
# transport specific extensions to netbios.
len*: char
access_control*: char
frame_control*: char
destination_addr*: array[0..5, char]
source_addr*: array[0..5, char]
routing_info*: array[0..17, char]
PActionHeader* = ptr ActionHeader
ActionHeader* {.final.} = object
transport_id*: int32
action_code*: int16
reserved*: int16
{.deprecated: [TFindNameHeader: FindNameHeader, TFindNameBuffer: FindNameBuffer,
TActionHeader: ActionHeader].}
const # Values for transport_id
ALL_TRANSPORTS* = "M\0\0\0"
MS_NBF* = "MNBF" # Special values and constants
const # NCB Command codes
NCBCALL* = 0x00000010 # NCB CALL
NCBLISTEN* = 0x00000011 # NCB LISTEN
NCBHANGUP* = 0x00000012 # NCB HANG UP
NCBSEND* = 0x00000014 # NCB SEND
NCBRECV* = 0x00000015 # NCB RECEIVE
NCBRECVANY* = 0x00000016 # NCB RECEIVE ANY
NCBCHAINSEND* = 0x00000017 # NCB CHAIN SEND
NCBDGSEND* = 0x00000020 # NCB SEND DATAGRAM
NCBDGRECV* = 0x00000021 # NCB RECEIVE DATAGRAM
NCBDGSENDBC* = 0x00000022 # NCB SEND BROADCAST DATAGRAM
NCBDGRECVBC* = 0x00000023 # NCB RECEIVE BROADCAST DATAGRAM
NCBADDNAME* = 0x00000030 # NCB ADD NAME
NCBDELNAME* = 0x00000031 # NCB DELETE NAME
NCBRESET* = 0x00000032 # NCB RESET
NCBASTAT* = 0x00000033 # NCB ADAPTER STATUS
NCBSSTAT* = 0x00000034 # NCB SESSION STATUS
NCBCANCEL* = 0x00000035 # NCB CANCEL
NCBADDGRNAME* = 0x00000036 # NCB ADD GROUP NAME
NCBENUM* = 0x00000037 # NCB ENUMERATE LANA NUMBERS
NCBUNLINK* = 0x00000070 # NCB UNLINK
NCBSENDNA* = 0x00000071 # NCB SEND NO ACK
NCBCHAINSENDNA* = 0x00000072 # NCB CHAIN SEND NO ACK
NCBLANSTALERT* = 0x00000073 # NCB LAN STATUS ALERT
NCBACTION* = 0x00000077 # NCB ACTION
NCBFINDNAME* = 0x00000078 # NCB FIND NAME
NCBTRACE* = 0x00000079 # NCB TRACE
ASYNCH* = 0x00000080 # high bit set = asynchronous
# NCB Return codes
NRC_GOODRET* = 0x00000000 # good return
# also returned when ASYNCH request accepted
NRC_BUFLEN* = 0x00000001 # illegal buffer length
NRC_ILLCMD* = 0x00000003 # illegal command
NRC_CMDTMO* = 0x00000005 # command timed out
NRC_INCOMP* = 0x00000006 # message incomplete, issue another command
NRC_BADDR* = 0x00000007 # illegal buffer address
NRC_SNUMOUT* = 0x00000008 # session number out of range
NRC_NORES* = 0x00000009 # no resource available
NRC_SCLOSED* = 0x0000000A # session closed
NRC_CMDCAN* = 0x0000000B # command cancelled
NRC_DUPNAME* = 0x0000000D # duplicate name
NRC_NAMTFUL* = 0x0000000E # name table full
NRC_ACTSES* = 0x0000000F # no deletions, name has active sessions
NRC_LOCTFUL* = 0x00000011 # local session table full
NRC_REMTFUL* = 0x00000012 # remote session table full
NRC_ILLNN* = 0x00000013 # illegal name number
NRC_NOCALL* = 0x00000014 # no callname
NRC_NOWILD* = 0x00000015 # cannot put * in NCB_NAME
NRC_INUSE* = 0x00000016 # name in use on remote adapter
NRC_NAMERR* = 0x00000017 # name deleted
NRC_SABORT* = 0x00000018 # session ended abnormally
NRC_NAMCONF* = 0x00000019 # name conflict detected
NRC_IFBUSY* = 0x00000021 # interface busy, IRET before retrying
NRC_TOOMANY* = 0x00000022 # too many commands outstanding, retry later
NRC_BRIDGE* = 0x00000023 # NCB_lana_num field invalid
NRC_CANOCCR* = 0x00000024 # command completed while cancel occurring
NRC_CANCEL* = 0x00000026 # command not valid to cancel
NRC_DUPENV* = 0x00000030 # name defined by anther local process
NRC_ENVNOTDEF* = 0x00000034 # environment undefined. RESET required
NRC_OSRESNOTAV* = 0x00000035 # required OS resources exhausted
NRC_MAXAPPS* = 0x00000036 # max number of applications exceeded
NRC_NOSAPS* = 0x00000037 # no saps available for netbios
NRC_NORESOURCES* = 0x00000038 # requested resources are not available
NRC_INVADDRESS* = 0x00000039 # invalid ncb address or length > segment
NRC_INVDDID* = 0x0000003B # invalid NCB DDID
NRC_LOCKFAIL* = 0x0000003C # lock of user area failed
NRC_OPENERR* = 0x0000003F # NETBIOS not loaded
NRC_SYSTEM* = 0x00000040 # system error
NRC_PENDING* = 0x000000FF # asynchronous command is not yet finished
# main user entry point for NetBIOS 3.0
# Usage: Result = Netbios( pncb );
proc Netbios*(P: PNCB): char{.stdcall, dynlib: "netapi32.dll",
importc: "Netbios".}
# implementation

View File

@@ -1,202 +0,0 @@
#
#
# Nim's Runtime Library
# (c) Copyright 2009 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# PSAPI interface unit
# Contains the definitions for the APIs provided by PSAPI.DLL
import # Data structure templates
Windows
const
psapiDll = "psapi.dll"
proc EnumProcesses*(lpidProcess: ptr DWORD, cb: DWORD,
cbNeeded: ptr DWORD): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "EnumProcesses".}
proc EnumProcessModules*(hProcess: HANDLE, lphModule: ptr HMODULE, cb: DWORD, lpcbNeeded: LPDWORD): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "EnumProcessModules".}
proc GetModuleBaseNameA*(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetModuleBaseNameA".}
proc GetModuleBaseNameW*(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetModuleBaseNameW".}
when defined(winUnicode):
proc GetModuleBaseName*(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetModuleBaseNameW".}
else:
proc GetModuleBaseName*(hProcess: HANDLE, hModule: HMODULE, lpBaseName: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetModuleBaseNameA".}
proc GetModuleFileNameExA*(hProcess: HANDLE, hModule: HMODULE, lpFileNameEx: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetModuleFileNameExA".}
proc GetModuleFileNameExW*(hProcess: HANDLE, hModule: HMODULE, lpFileNameEx: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetModuleFileNameExW".}
when defined(winUnicode):
proc GetModuleFileNameEx*(hProcess: HANDLE, hModule: HMODULE, lpFileNameEx: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetModuleFileNameExW".}
else:
proc GetModuleFileNameEx*(hProcess: HANDLE, hModule: HMODULE, lpFileNameEx: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetModuleFileNameExA".}
type
MODULEINFO* {.final.} = object
lpBaseOfDll*: LPVOID
SizeOfImage*: DWORD
EntryPoint*: LPVOID
LPMODULEINFO* = ptr MODULEINFO
proc GetModuleInformation*(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: LPMODULEINFO, cb: DWORD): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "GetModuleInformation".}
proc EmptyWorkingSet*(hProcess: HANDLE): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "EmptyWorkingSet".}
proc QueryWorkingSet*(hProcess: HANDLE, pv: PVOID, cb: DWORD): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "QueryWorkingSet".}
proc QueryWorkingSetEx*(hProcess: HANDLE, pv: PVOID, cb: DWORD): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "QueryWorkingSetEx".}
proc InitializeProcessForWsWatch*(hProcess: HANDLE): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "InitializeProcessForWsWatch".}
type
PSAPI_WS_WATCH_INFORMATION* {.final.} = object
FaultingPc*: LPVOID
FaultingVa*: LPVOID
PPSAPI_WS_WATCH_INFORMATION* = ptr PSAPI_WS_WATCH_INFORMATION
proc GetWsChanges*(hProcess: HANDLE, lpWatchInfo: PPSAPI_WS_WATCH_INFORMATION, cb: DWORD): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "GetWsChanges".}
proc GetMappedFileNameA*(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetMappedFileNameA".}
proc GetMappedFileNameW*(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetMappedFileNameW".}
when defined(winUnicode):
proc GetMappedFileName*(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetMappedFileNameW".}
else:
proc GetMappedFileName*(hProcess: HANDLE, lpv: LPVOID, lpFilename: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetMappedFileNameA".}
proc EnumDeviceDrivers*(lpImageBase: LPVOID, cb: DWORD, lpcbNeeded: LPDWORD): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "EnumDeviceDrivers".}
proc GetDeviceDriverBaseNameA*(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetDeviceDriverBaseNameA".}
proc GetDeviceDriverBaseNameW*(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetDeviceDriverBaseNameW".}
when defined(winUnicode):
proc GetDeviceDriverBaseName*(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetDeviceDriverBaseNameW".}
else:
proc GetDeviceDriverBaseName*(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetDeviceDriverBaseNameA".}
proc GetDeviceDriverFileNameA*(ImageBase: LPVOID, lpFileName: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetDeviceDriverFileNameA".}
proc GetDeviceDriverFileNameW*(ImageBase: LPVOID, lpFileName: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetDeviceDriverFileNameW".}
when defined(winUnicode):
proc GetDeviceDriverFileName*(ImageBase: LPVOID, lpFileName: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetDeviceDriverFileNameW".}
else:
proc GetDeviceDriverFileName*(ImageBase: LPVOID, lpFileName: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetDeviceDriverFileNameA".}
type
PROCESS_MEMORY_COUNTERS* {.final.} = object
cb*: DWORD
PageFaultCount*: DWORD
PeakWorkingSetSize: SIZE_T
WorkingSetSize: SIZE_T
QuotaPeakPagedPoolUsage: SIZE_T
QuotaPagedPoolUsage: SIZE_T
QuotaPeakNonPagedPoolUsage: SIZE_T
QuotaNonPagedPoolUsage: SIZE_T
PagefileUsage: SIZE_T
PeakPagefileUsage: SIZE_T
PPROCESS_MEMORY_COUNTERS* = ptr PROCESS_MEMORY_COUNTERS
type
PROCESS_MEMORY_COUNTERS_EX* {.final.} = object
cb*: DWORD
PageFaultCount*: DWORD
PeakWorkingSetSize: SIZE_T
WorkingSetSize: SIZE_T
QuotaPeakPagedPoolUsage: SIZE_T
QuotaPagedPoolUsage: SIZE_T
QuotaPeakNonPagedPoolUsage: SIZE_T
QuotaNonPagedPoolUsage: SIZE_T
PagefileUsage: SIZE_T
PeakPagefileUsage: SIZE_T
PrivateUsage: SIZE_T
PPROCESS_MEMORY_COUNTERS_EX* = ptr PROCESS_MEMORY_COUNTERS_EX
proc GetProcessMemoryInfo*(hProcess: HANDLE, ppsmemCounters: PPROCESS_MEMORY_COUNTERS, cb: DWORD): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "GetProcessMemoryInfo".}
type
PERFORMANCE_INFORMATION* {.final.} = object
cb*: DWORD
CommitTotal: SIZE_T
CommitLimit: SIZE_T
CommitPeak: SIZE_T
PhysicalTotal: SIZE_T
PhysicalAvailable: SIZE_T
SystemCache: SIZE_T
KernelTotal: SIZE_T
KernelPaged: SIZE_T
KernelNonpaged: SIZE_T
PageSize: SIZE_T
HandleCount*: DWORD
ProcessCount*: DWORD
ThreadCount*: DWORD
PPERFORMANCE_INFORMATION* = ptr PERFORMANCE_INFORMATION
# Skip definition of PERFORMACE_INFORMATION...
proc GetPerformanceInfo*(pPerformanceInformation: PPERFORMANCE_INFORMATION, cb: DWORD): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "GetPerformanceInfo".}
type
ENUM_PAGE_FILE_INFORMATION* {.final.} = object
cb*: DWORD
Reserved*: DWORD
TotalSize: SIZE_T
TotalInUse: SIZE_T
PeakUsage: SIZE_T
PENUM_PAGE_FILE_INFORMATION* = ptr ENUM_PAGE_FILE_INFORMATION
# Callback procedure
type
PENUM_PAGE_FILE_CALLBACKW* = proc (pContext: LPVOID, pPageFileInfo: PENUM_PAGE_FILE_INFORMATION, lpFilename: LPCWSTR): WINBOOL{.stdcall.}
PENUM_PAGE_FILE_CALLBACKA* = proc (pContext: LPVOID, pPageFileInfo: PENUM_PAGE_FILE_INFORMATION, lpFilename: LPCSTR): WINBOOL{.stdcall.}
#TODO
proc EnumPageFilesA*(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "EnumPageFilesA".}
proc EnumPageFilesW*(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "EnumPageFilesW".}
when defined(winUnicode):
proc EnumPageFiles*(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "EnumPageFilesW".}
type PENUM_PAGE_FILE_CALLBACK* = proc (pContext: LPVOID, pPageFileInfo: PENUM_PAGE_FILE_INFORMATION, lpFilename: LPCWSTR): WINBOOL{.stdcall.}
else:
proc EnumPageFiles*(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID): WINBOOL {.stdcall,
dynlib: psapiDll, importc: "EnumPageFilesA".}
type PENUM_PAGE_FILE_CALLBACK* = proc (pContext: LPVOID, pPageFileInfo: PENUM_PAGE_FILE_INFORMATION, lpFilename: LPCSTR): WINBOOL{.stdcall.}
proc GetProcessImageFileNameA*(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetProcessImageFileNameA".}
proc GetProcessImageFileNameW*(hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetProcessImageFileNameW".}
when defined(winUnicode):
proc GetProcessImageFileName*(hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetProcessImageFileNameW".}
else:
proc GetProcessImageFileName*(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD): DWORD {.stdcall,
dynlib: psapiDll, importc: "GetProcessImageFileNameA".}

View File

@@ -1,863 +0,0 @@
#
#
# Nim's Runtime Library
# (c) Copyright 2006 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
{.deadCodeElim: on.}
# leave out unused functions so the unit can be used on win2000 as well
#+-------------------------------------------------------------------------
#
# Microsoft Windows
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# File: shellapi.h
#
# Header translation by Marco van de Voort for Free Pascal Platform
# SDK dl'ed January 2002
#
#--------------------------------------------------------------------------
#
# shellapi.h - SHELL.DLL functions, types, and definitions
# Copyright (c) Microsoft Corporation. All rights reserved.
import
windows
type
HDROP* = Handle
UINT_PTR* = ptr uint32
DWORD_PTR* = ptr DWORD
PHICON* = ptr HICON
PBool* = ptr bool
STARTUPINFOW* {.final.} = object # a guess. Omission should get fixed in Windows.
cb*: DWORD
lpReserved*: LPTSTR
lpDesktop*: LPTSTR
lpTitle*: LPTSTR
dwX*: DWORD
dwY*: DWORD
dwXSize*: DWORD
dwYSize*: DWORD
dwXCountChars*: DWORD
dwYCountChars*: DWORD
dwFillAttribute*: DWORD
dwFlags*: DWORD
wShowWindow*: int16
cbReserved2*: int16
lpReserved2*: LPBYTE
hStdInput*: HANDLE
hStdOutput*: HANDLE
hStdError*: HANDLE
LPSTARTUPINFOW* = ptr STARTUPINFOW
PSTARTUPINFOW* = ptr STARTUPINFOW #unicode
{.deprecated: [TSTARTUPINFOW: STARTUPINFOW].}
proc DragQueryFileA*(arg1: HDROP, arg2: uint32, arg3: LPSTR, arg4: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileA".}
proc DragQueryFileW*(arg1: HDROP, arg2: uint32, arg3: LPWSTR, arg4: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileW".}
proc DragQueryFile*(arg1: HDROP, arg2: uint32, arg3: LPSTR, arg4: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileA".}
proc DragQueryFile*(arg1: HDROP, arg2: uint32, arg3: LPWSTR, arg4: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileW".}
proc DragQueryPoint*(arg1: HDROP, arg2: LPPOINT): bool{.stdcall,
dynlib: "shell32.dll", importc: "DragQueryPoint".}
proc DragFinish*(arg1: HDROP){.stdcall, dynlib: "shell32.dll",
importc: "DragFinish".}
proc DragAcceptFiles*(hwnd: HWND, arg2: bool){.stdcall, dynlib: "shell32.dll",
importc: "DragAcceptFiles".}
proc ShellExecuteA*(hwnd: HWND, lpOperation: LPCSTR, lpFile: LPCSTR,
lpParameters: LPCSTR, lpDirectory: LPCSTR, nShowCmd: int32): HInst{.
stdcall, dynlib: "shell32.dll", importc: "ShellExecuteA".}
proc ShellExecuteW*(hwnd: HWND, lpOperation: LPCWSTR, lpFile: LPCWSTR,
lpParameters: LPCWSTR, lpDirectory: LPCWSTR, nShowCmd: int32): HInst{.
stdcall, dynlib: "shell32.dll", importc: "ShellExecuteW".}
proc ShellExecute*(hwnd: HWND, lpOperation: LPCSTR, lpFile: LPCSTR,
lpParameters: LPCSTR, lpDirectory: LPCSTR, nShowCmd: int32): HInst{.
stdcall, dynlib: "shell32.dll", importc: "ShellExecuteA".}
proc ShellExecute*(hwnd: HWND, lpOperation: LPCWSTR, lpFile: LPCWSTR,
lpParameters: LPCWSTR, lpDirectory: LPCWSTR, nShowCmd: int32): HInst{.
stdcall, dynlib: "shell32.dll", importc: "ShellExecuteW".}
proc FindExecutableA*(lpFile: LPCSTR, lpDirectory: LPCSTR, lpResult: LPSTR): HInst{.
stdcall, dynlib: "shell32.dll", importc: "FindExecutableA".}
proc FindExecutableW*(lpFile: LPCWSTR, lpDirectory: LPCWSTR, lpResult: LPWSTR): HInst{.
stdcall, dynlib: "shell32.dll", importc: "FindExecutableW".}
proc FindExecutable*(lpFile: LPCSTR, lpDirectory: LPCSTR, lpResult: LPSTR): HInst{.
stdcall, dynlib: "shell32.dll", importc: "FindExecutableA".}
proc FindExecutable*(lpFile: LPCWSTR, lpDirectory: LPCWSTR, lpResult: LPWSTR): HInst{.
stdcall, dynlib: "shell32.dll", importc: "FindExecutableW".}
proc CommandLineToArgvW*(lpCmdLine: LPCWSTR, pNumArgs: ptr int32): PLPWSTR{.
stdcall, dynlib: "shell32.dll", importc: "CommandLineToArgvW".}
proc ShellAboutA*(hwnd: HWND, szApp: LPCSTR, szOtherStuff: LPCSTR, hIcon: HICON): int32{.
stdcall, dynlib: "shell32.dll", importc: "ShellAboutA".}
proc ShellAboutW*(hwnd: HWND, szApp: LPCWSTR, szOtherStuff: LPCWSTR,
hIcon: HICON): int32{.stdcall, dynlib: "shell32.dll",
importc: "ShellAboutW".}
proc ShellAbout*(hwnd: HWND, szApp: LPCSTR, szOtherStuff: LPCSTR, hIcon: HICON): int32{.
stdcall, dynlib: "shell32.dll", importc: "ShellAboutA".}
proc ShellAbout*(hwnd: HWND, szApp: LPCWSTR, szOtherStuff: LPCWSTR, hIcon: HICON): int32{.
stdcall, dynlib: "shell32.dll", importc: "ShellAboutW".}
proc DuplicateIcon*(inst: HINST, icon: HICON): HIcon{.stdcall,
dynlib: "shell32.dll", importc: "DuplicateIcon".}
proc ExtractAssociatedIconA*(hInst: HINST, lpIconPath: LPSTR, lpiIcon: LPWORD): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractAssociatedIconA".}
proc ExtractAssociatedIconW*(hInst: HINST, lpIconPath: LPWSTR, lpiIcon: LPWORD): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractAssociatedIconW".}
proc ExtractAssociatedIcon*(hInst: HINST, lpIconPath: LPSTR, lpiIcon: LPWORD): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractAssociatedIconA".}
proc ExtractAssociatedIcon*(hInst: HINST, lpIconPath: LPWSTR, lpiIcon: LPWORD): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractAssociatedIconW".}
proc ExtractIconA*(hInst: HINST, lpszExeFileName: LPCSTR, nIconIndex: uint32): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconA".}
proc ExtractIconW*(hInst: HINST, lpszExeFileName: LPCWSTR, nIconIndex: uint32): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconW".}
proc ExtractIcon*(hInst: HINST, lpszExeFileName: LPCSTR, nIconIndex: uint32): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconA".}
proc ExtractIcon*(hInst: HINST, lpszExeFileName: LPCWSTR, nIconIndex: uint32): HICON{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconW".}
# if(WINVER >= 0x0400)
type # init with sizeof(DRAGINFO)
DRAGINFOA* {.final.} = object
uSize*: uint32
pt*: POINT
fNC*: bool
lpFileList*: LPSTR
grfKeyState*: DWORD
LPDRAGINFOA* = ptr DRAGINFOA # init with sizeof(DRAGINFO)
DRAGINFOW* {.final.} = object
uSize*: uint32
pt*: POINT
fNC*: bool
lpFileList*: LPWSTR
grfKeyState*: DWORD
LPDRAGINFOW* = ptr DRAGINFOW
{.deprecated: [TDRAGINFOA: DRAGINFOA, TDRAGINFOW: DRAGINFOW].}
when defined(UNICODE):
type
DRAGINFO* = DRAGINFOW
LPDRAGINFO* = LPDRAGINFOW
{.deprecated: [TDRAGINFO: DRAGINFOW].}
else:
type
DRAGINFO* = DRAGINFOA
LPDRAGINFO* = LPDRAGINFOA
{.deprecated: [TDRAGINFO: DRAGINFOW].}
const
ABM_NEW* = 0x00000000
ABM_REMOVE* = 0x00000001
ABM_QUERYPOS* = 0x00000002
ABM_SETPOS* = 0x00000003
ABM_GETSTATE* = 0x00000004
ABM_GETTASKBARPOS* = 0x00000005
ABM_ACTIVATE* = 0x00000006 # lParam == TRUE/FALSE means activate/deactivate
ABM_GETAUTOHIDEBAR* = 0x00000007
ABM_SETAUTOHIDEBAR* = 0x00000008 # this can fail at any time. MUST check the result
# lParam = TRUE/FALSE Set/Unset
# uEdge = what edge
ABM_WINDOWPOSCHANGED* = 0x00000009
ABM_SETSTATE* = 0x0000000A
ABN_STATECHANGE* = 0x00000000 # these are put in the wparam of callback messages
ABN_POSCHANGED* = 0x00000001
ABN_FULLSCREENAPP* = 0x00000002
ABN_WINDOWARRANGE* = 0x00000003 # lParam == TRUE means hide
# flags for get state
ABS_AUTOHIDE* = 0x00000001
ABS_ALWAYSONTOP* = 0x00000002
ABE_LEFT* = 0
ABE_TOP* = 1
ABE_RIGHT* = 2
ABE_BOTTOM* = 3
type
AppBarData* {.final.} = object
cbSize*: DWORD
hWnd*: HWND
uCallbackMessage*: uint32
uEdge*: uint32
rc*: RECT
lParam*: LPARAM # message specific
PAPPBARDATA* = ptr AppBarData
{.deprecated: [TAPPBARDATA: AppBarData].}
proc SHAppBarMessage*(dwMessage: DWORD, pData: APPBARDATA): UINT_PTR{.stdcall,
dynlib: "shell32.dll", importc: "SHAppBarMessage".}
#
# EndAppBar
#
proc DoEnvironmentSubstA*(szString: LPSTR, cchString: uint32): DWORD{.stdcall,
dynlib: "shell32.dll", importc: "DoEnvironmentSubstA".}
proc DoEnvironmentSubstW*(szString: LPWSTR, cchString: uint32): DWORD{.stdcall,
dynlib: "shell32.dll", importc: "DoEnvironmentSubstW".}
proc DoEnvironmentSubst*(szString: LPSTR, cchString: uint32): DWORD{.stdcall,
dynlib: "shell32.dll", importc: "DoEnvironmentSubstA".}
proc DoEnvironmentSubst*(szString: LPWSTR, cchString: uint32): DWORD{.stdcall,
dynlib: "shell32.dll", importc: "DoEnvironmentSubstW".}
#Macro
proc EIRESID*(x: int32): int32
proc ExtractIconExA*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: PHICON,
phiconSmall: PHICON, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExA".}
proc ExtractIconExW*(lpszFile: LPCWSTR, nIconIndex: int32, phiconLarge: PHICON,
phiconSmall: PHICON, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExW".}
proc ExtractIconExA*(lpszFile: LPCSTR, nIconIndex: int32,
phiconLarge: var HICON, phiconSmall: var HIcon,
nIcons: uint32): uint32{.stdcall, dynlib: "shell32.dll",
importc: "ExtractIconExA".}
proc ExtractIconExW*(lpszFile: LPCWSTR, nIconIndex: int32,
phiconLarge: var HICON, phiconSmall: var HIcon,
nIcons: uint32): uint32{.stdcall, dynlib: "shell32.dll",
importc: "ExtractIconExW".}
proc ExtractIconEx*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: PHICON,
phiconSmall: PHICON, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExA".}
proc ExtractIconEx*(lpszFile: LPCWSTR, nIconIndex: int32, phiconLarge: PHICON,
phiconSmall: PHICON, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExW".}
proc ExtractIconEx*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: var HICON,
phiconSmall: var HIcon, nIcons: uint32): uint32{.stdcall,
dynlib: "shell32.dll", importc: "ExtractIconExA".}
proc ExtractIconEx*(lpszFile: LPCWSTR, nIconIndex: int32,
phiconLarge: var HICON, phiconSmall: var HIcon, nIcons: uint32): uint32{.
stdcall, dynlib: "shell32.dll", importc: "ExtractIconExW".}
#
# Shell File Operations
#
#ifndef FO_MOVE //these need to be kept in sync with the ones in shlobj.h}
const
FO_MOVE* = 0x00000001
FO_COPY* = 0x00000002
FO_DELETE* = 0x00000003
FO_RENAME* = 0x00000004
FOF_MULTIDESTFILES* = 0x00000001
FOF_CONFIRMMOUSE* = 0x00000002
FOF_SILENT* = 0x00000004 # don't create progress/report
FOF_RENAMEONCOLLISION* = 0x00000008
FOF_NOCONFIRMATION* = 0x00000010 # Don't prompt the user.
FOF_WANTMAPPINGHANDLE* = 0x00000020 # Fill in SHFILEOPSTRUCT.hNameMappings
FOF_ALLOWUNDO* = 0x00000040 # Must be freed using SHFreeNameMappings
FOF_FILESONLY* = 0x00000080 # on *.*, do only files
FOF_SIMPLEPROGRESS* = 0x00000100 # means don't show names of files
FOF_NOCONFIRMMKDIR* = 0x00000200 # don't confirm making any needed dirs
FOF_NOERRORUI* = 0x00000400 # don't put up error UI
FOF_NOCOPYSECURITYATTRIBS* = 0x00000800 # dont copy NT file Security Attributes
FOF_NORECURSION* = 0x00001000 # don't recurse into directories.
#if (_WIN32_IE >= 0x0500)
FOF_NO_CONNECTED_ELEMENTS* = 0x00002000 # don't operate on connected elements.
FOF_WANTNUKEWARNING* = 0x00004000 # during delete operation, warn if nuking instead of recycling (partially overrides FOF_NOCONFIRMATION)
#endif
#if (_WIN32_WINNT >= 0x0501)
FOF_NORECURSEREPARSE* = 0x00008000 # treat reparse points as objects, not containers
#endif
type
FILEOP_FLAGS* = int16
const
PO_DELETE* = 0x00000013 # printer is being deleted
PO_RENAME* = 0x00000014 # printer is being renamed
PO_PORTCHANGE* = 0x00000020 # port this printer connected to is being changed
# if this id is set, the strings received by
# the copyhook are a doubly-null terminated
# list of strings. The first is the printer
# name and the second is the printer port.
PO_REN_PORT* = 0x00000034 # PO_RENAME and PO_PORTCHANGE at same time.
# no POF_ flags currently defined
type
PRINTEROP_FLAGS* = int16 #endif}
# FO_MOVE
# implicit parameters are:
# if pFrom or pTo are unqualified names the current directories are
# taken from the global current drive/directory settings managed
# by Get/SetCurrentDrive/Directory
#
# the global confirmation settings
# only used if FOF_SIMPLEPROGRESS
type
SHFILEOPSTRUCTA* {.final.} = object
hwnd*: HWND
wFunc*: uint32
pFrom*: LPCSTR
pTo*: LPCSTR
fFlags*: FILEOP_FLAGS
fAnyOperationsAborted*: bool
hNameMappings*: LPVOID
lpszProgressTitle*: LPCSTR # only used if FOF_SIMPLEPROGRESS
LPSHFILEOPSTRUCTA* = ptr SHFILEOPSTRUCTA
SHFILEOPSTRUCTW* {.final.} = object
hwnd*: HWND
wFunc*: uint32
pFrom*: LPCWSTR
pTo*: LPCWSTR
fFlags*: FILEOP_FLAGS
fAnyOperationsAborted*: bool
hNameMappings*: LPVOID
lpszProgressTitle*: LPCWSTR
LPSHFILEOPSTRUCTW* = ptr SHFILEOPSTRUCTW
{.deprecated: [TSHFILEOPSTRUCTA: SHFILEOPSTRUCTA,
TSHFILEOPSTRUCTW: SHFILEOPSTRUCTW].}
when defined(UNICODE):
type
SHFILEOPSTRUCT* = SHFILEOPSTRUCTW
LPSHFILEOPSTRUCT* = LPSHFILEOPSTRUCTW
{.deprecated: [TSHFILEOPSTRUCT: SHFILEOPSTRUCTW].}
else:
type
SHFILEOPSTRUCT* = SHFILEOPSTRUCTA
LPSHFILEOPSTRUCT* = LPSHFILEOPSTRUCTA
{.deprecated: [TSHFILEOPSTRUCT: SHFILEOPSTRUCTA].}
proc SHFileOperationA*(lpFileOp: LPSHFILEOPSTRUCTA): int32{.stdcall,
dynlib: "shell32.dll", importc: "SHFileOperationA".}
proc SHFileOperationW*(lpFileOp: LPSHFILEOPSTRUCTW): int32{.stdcall,
dynlib: "shell32.dll", importc: "SHFileOperationW".}
proc SHFileOperation*(lpFileOp: LPSHFILEOPSTRUCTA): int32{.stdcall,
dynlib: "shell32.dll", importc: "SHFileOperationA".}
proc SHFileOperation*(lpFileOp: LPSHFILEOPSTRUCTW): int32{.stdcall,
dynlib: "shell32.dll", importc: "SHFileOperationW".}
proc SHFreeNameMappings*(hNameMappings: Handle){.stdcall,
dynlib: "shell32.dll", importc: "SHFreeNameMappings".}
type
SHNAMEMAPPINGA* {.final.} = object
pszOldPath*: LPSTR
pszNewPath*: LPSTR
cchOldPath*: int32
cchNewPath*: int32
LPSHNAMEMAPPINGA* = ptr SHNAMEMAPPINGA
SHNAMEMAPPINGW* {.final.} = object
pszOldPath*: LPWSTR
pszNewPath*: LPWSTR
cchOldPath*: int32
cchNewPath*: int32
LPSHNAMEMAPPINGW* = ptr SHNAMEMAPPINGW
{.deprecated: [TSHNAMEMAPPINGA: SHNAMEMAPPINGA,
TSHNAMEMAPPINGW: SHNAMEMAPPINGW].}
when not(defined(UNICODE)):
type
SHNAMEMAPPING* = SHNAMEMAPPINGW
LPSHNAMEMAPPING* = LPSHNAMEMAPPINGW
{.deprecated: [TSHNAMEMAPPING: SHNAMEMAPPINGW].}
else:
type
SHNAMEMAPPING* = SHNAMEMAPPINGA
LPSHNAMEMAPPING* = LPSHNAMEMAPPINGA
{.deprecated: [TSHNAMEMAPPING: SHNAMEMAPPINGA].}
#
# End Shell File Operations
#
#
# Begin ShellExecuteEx and family
#
# ShellExecute() and ShellExecuteEx() error codes
# regular WinExec() codes
const
SE_ERR_FNF* = 2 # file not found
SE_ERR_PNF* = 3 # path not found
SE_ERR_ACCESSDENIED* = 5 # access denied
SE_ERR_OOM* = 8 # out of memory
SE_ERR_DLLNOTFOUND* = 32 # endif WINVER >= 0x0400
# error values for ShellExecute() beyond the regular WinExec() codes
SE_ERR_SHARE* = 26
SE_ERR_ASSOCINCOMPLETE* = 27
SE_ERR_DDETIMEOUT* = 28
SE_ERR_DDEFAIL* = 29
SE_ERR_DDEBUSY* = 30
SE_ERR_NOASSOC* = 31 #if(WINVER >= 0x0400)}
# Note CLASSKEY overrides CLASSNAME
SEE_MASK_CLASSNAME* = 0x00000001
SEE_MASK_CLASSKEY* = 0x00000003 # Note INVOKEIDLIST overrides IDLIST
SEE_MASK_IDLIST* = 0x00000004
SEE_MASK_INVOKEIDLIST* = 0x0000000C
SEE_MASK_ICON* = 0x00000010
SEE_MASK_HOTKEY* = 0x00000020
SEE_MASK_NOCLOSEPROCESS* = 0x00000040
SEE_MASK_CONNECTNETDRV* = 0x00000080
SEE_MASK_FLAG_DDEWAIT* = 0x00000100
SEE_MASK_DOENVSUBST* = 0x00000200
SEE_MASK_FLAG_NO_UI* = 0x00000400
SEE_MASK_UNICODE* = 0x00004000
SEE_MASK_NO_CONSOLE* = 0x00008000
SEE_MASK_ASYNCOK* = 0x00100000
SEE_MASK_HMONITOR* = 0x00200000 #if (_WIN32_IE >= 0x0500)
SEE_MASK_NOQUERYCLASSSTORE* = 0x01000000
SEE_MASK_WAITFORINPUTIDLE* = 0x02000000 #endif (_WIN32_IE >= 0x500)
#if (_WIN32_IE >= 0x0560)
SEE_MASK_FLAG_LOG_USAGE* = 0x04000000 #endif
# (_WIN32_IE >= 0x560)
type
SHELLEXECUTEINFOA* {.final.} = object
cbSize*: DWORD
fMask*: ULONG
hwnd*: HWND
lpVerb*: LPCSTR
lpFile*: LPCSTR
lpParameters*: LPCSTR
lpDirectory*: LPCSTR
nShow*: int32
hInstApp*: HINST
lpIDList*: LPVOID
lpClass*: LPCSTR
hkeyClass*: HKEY
dwHotKey*: DWORD
hMonitor*: HANDLE # also: hIcon
hProcess*: HANDLE
LPSHELLEXECUTEINFOA* = ptr SHELLEXECUTEINFOA
SHELLEXECUTEINFOW* {.final.} = object
cbSize*: DWORD
fMask*: ULONG
hwnd*: HWND
lpVerb*: LPCWSTR
lpFile*: LPCWSTR
lpParameters*: LPCWSTR
lpDirectory*: LPCWSTR
nShow*: int32
hInstApp*: HINST
lpIDList*: LPVOID
lpClass*: LPCWSTR
hkeyClass*: HKEY
dwHotKey*: DWORD
hMonitor*: HANDLE # also: hIcon
hProcess*: HANDLE
LPSHELLEXECUTEINFOW* = ptr SHELLEXECUTEINFOW
{.deprecated: [TSHELLEXECUTEINFOA: SHELLEXECUTEINFOA,
TSHELLEXECUTEINFOW: SHELLEXECUTEINFOW].}
when defined(UNICODE):
type
SHELLEXECUTEINFO* = SHELLEXECUTEINFOW
LPSHELLEXECUTEINFO* = LPSHELLEXECUTEINFOW
{.deprecated: [TSHELLEXECUTEINFO: SHELLEXECUTEINFOW].}
else:
type
SHELLEXECUTEINFO* = SHELLEXECUTEINFOA
LPSHELLEXECUTEINFO* = LPSHELLEXECUTEINFOA
{.deprecated: [TSHELLEXECUTEINFO: SHELLEXECUTEINFOA].}
proc ShellExecuteExA*(lpExecInfo: LPSHELLEXECUTEINFOA): bool{.stdcall,
dynlib: "shell32.dll", importc: "ShellExecuteExA".}
proc ShellExecuteExW*(lpExecInfo: LPSHELLEXECUTEINFOW): bool{.stdcall,
dynlib: "shell32.dll", importc: "ShellExecuteExW".}
proc ShellExecuteEx*(lpExecInfo: LPSHELLEXECUTEINFOA): bool{.stdcall,
dynlib: "shell32.dll", importc: "ShellExecuteExA".}
proc ShellExecuteEx*(lpExecInfo: LPSHELLEXECUTEINFOW): bool{.stdcall,
dynlib: "shell32.dll", importc: "ShellExecuteExW".}
proc WinExecErrorA*(hwnd: HWND, error: int32, lpstrFileName: LPCSTR,
lpstrTitle: LPCSTR){.stdcall, dynlib: "shell32.dll",
importc: "WinExecErrorA".}
proc WinExecErrorW*(hwnd: HWND, error: int32, lpstrFileName: LPCWSTR,
lpstrTitle: LPCWSTR){.stdcall, dynlib: "shell32.dll",
importc: "WinExecErrorW".}
proc WinExecError*(hwnd: HWND, error: int32, lpstrFileName: LPCSTR,
lpstrTitle: LPCSTR){.stdcall, dynlib: "shell32.dll",
importc: "WinExecErrorA".}
proc WinExecError*(hwnd: HWND, error: int32, lpstrFileName: LPCWSTR,
lpstrTitle: LPCWSTR){.stdcall, dynlib: "shell32.dll",
importc: "WinExecErrorW".}
type
SHCREATEPROCESSINFOW* {.final.} = object
cbSize*: DWORD
fMask*: ULONG
hwnd*: HWND
pszFile*: LPCWSTR
pszParameters*: LPCWSTR
pszCurrentDirectory*: LPCWSTR
hUserToken*: HANDLE
lpProcessAttributes*: LPSECURITY_ATTRIBUTES
lpThreadAttributes*: LPSECURITY_ATTRIBUTES
bInheritHandles*: bool
dwCreationFlags*: DWORD
lpStartupInfo*: LPSTARTUPINFOW
lpProcessInformation*: LPPROCESS_INFORMATION
PSHCREATEPROCESSINFOW* = ptr SHCREATEPROCESSINFOW
{.deprecated: [TSHCREATEPROCESSINFOW: SHCREATEPROCESSINFOW].}
proc SHCreateProcessAsUserW*(pscpi: PSHCREATEPROCESSINFOW): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHCreateProcessAsUserW".}
#
# End ShellExecuteEx and family }
#
#
# RecycleBin
#
# struct for query recycle bin info
type
SHQUERYRBINFO* {.final.} = object
cbSize*: DWORD
i64Size*: int64
i64NumItems*: int64
LPSHQUERYRBINFO* = ptr SHQUERYRBINFO # flags for SHEmptyRecycleBin
{.deprecated: [TSHQUERYRBINFO: SHQUERYRBINFO].}
const
SHERB_NOCONFIRMATION* = 0x00000001
SHERB_NOPROGRESSUI* = 0x00000002
SHERB_NOSOUND* = 0x00000004
proc SHQueryRecycleBinA*(pszRootPath: LPCSTR, pSHQueryRBInfo: LPSHQUERYRBINFO): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHQueryRecycleBinA".}
proc SHQueryRecycleBinW*(pszRootPath: LPCWSTR, pSHQueryRBInfo: LPSHQUERYRBINFO): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHQueryRecycleBinW".}
proc SHQueryRecycleBin*(pszRootPath: LPCSTR, pSHQueryRBInfo: LPSHQUERYRBINFO): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHQueryRecycleBinA".}
proc SHQueryRecycleBin*(pszRootPath: LPCWSTR, pSHQueryRBInfo: LPSHQUERYRBINFO): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHQueryRecycleBinW".}
proc SHEmptyRecycleBinA*(hwnd: HWND, pszRootPath: LPCSTR, dwFlags: DWORD): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHEmptyRecycleBinA".}
proc SHEmptyRecycleBinW*(hwnd: HWND, pszRootPath: LPCWSTR, dwFlags: DWORD): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHEmptyRecycleBinW".}
proc SHEmptyRecycleBin*(hwnd: HWND, pszRootPath: LPCSTR, dwFlags: DWORD): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHEmptyRecycleBinA".}
proc SHEmptyRecycleBin*(hwnd: HWND, pszRootPath: LPCWSTR, dwFlags: DWORD): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHEmptyRecycleBinW".}
#
# end of RecycleBin
#
#
# Tray notification definitions
#
type
NOTIFYICONDATAA* {.final.} = object
cbSize*: DWORD
hWnd*: HWND
uID*: uint32
uFlags*: uint32
uCallbackMessage*: uint32
hIcon*: HICON
szTip*: array[0..127, char]
dwState*: DWORD
dwStateMask*: DWORD
szInfo*: array[0..255, char]
uTimeout*: uint32 # also: uVersion
szInfoTitle*: array[0..63, char]
dwInfoFlags*: DWORD
guidItem*: GUID
PNOTIFYICONDATAA* = ptr NOTIFYICONDATAA
NOTIFYICONDATAW* {.final.} = object
cbSize*: DWORD
hWnd*: HWND
uID*: uint32
uFlags*: uint32
uCallbackMessage*: uint32
hIcon*: HICON
szTip*: array[0..127, Wchar]
dwState*: DWORD
dwStateMask*: DWORD
szInfo*: array[0..255, Wchar]
uTimeout*: uint32 # also uVersion : UINT
szInfoTitle*: array[0..63, char]
dwInfoFlags*: DWORD
guidItem*: GUID
PNOTIFYICONDATAW* = ptr NOTIFYICONDATAW
{.deprecated: [TNOTIFYICONDATAA: NOTIFYICONDATAA,
TNOTIFYICONDATAW: NOTIFYICONDATAW].}
when defined(UNICODE):
type
NOTIFYICONDATA* = NOTIFYICONDATAW
PNOTIFYICONDATA* = PNOTIFYICONDATAW
{.deprecated: [TNOTIFYICONDATA: NOTIFYICONDATAW].}
else:
type
NOTIFYICONDATA* = NOTIFYICONDATAA
PNOTIFYICONDATA* = PNOTIFYICONDATAA
{.deprecated: [TNOTIFYICONDATA: NOTIFYICONDATAA].}
const
NIN_SELECT* = WM_USER + 0
NINF_KEY* = 0x00000001
NIN_KEYSELECT* = NIN_SELECT or NINF_KEY
NIN_BALLOONSHOW* = WM_USER + 2
NIN_BALLOONHIDE* = WM_USER + 3
NIN_BALLOONTIMEOUT* = WM_USER + 4
NIN_BALLOONUSERCLICK* = WM_USER + 5
NIM_ADD* = 0x00000000
NIM_MODIFY* = 0x00000001
NIM_DELETE* = 0x00000002
NIM_SETFOCUS* = 0x00000003
NIM_SETVERSION* = 0x00000004
NOTIFYICON_VERSION* = 3
NIF_MESSAGE* = 0x00000001
NIF_ICON* = 0x00000002
NIF_TIP* = 0x00000004
NIF_STATE* = 0x00000008
NIF_INFO* = 0x00000010
NIF_GUID* = 0x00000020
NIS_HIDDEN* = 0x00000001
NIS_SHAREDICON* = 0x00000002 # says this is the source of a shared icon
# Notify Icon Infotip flags
NIIF_NONE* = 0x00000000 # icon flags are mutually exclusive
# and take only the lowest 2 bits
NIIF_INFO* = 0x00000001
NIIF_WARNING* = 0x00000002
NIIF_ERROR* = 0x00000003
NIIF_ICON_MASK* = 0x0000000F
NIIF_NOSOUND* = 0x00000010
proc Shell_NotifyIconA*(dwMessage: Dword, lpData: PNOTIFYICONDATAA): bool{.
stdcall, dynlib: "shell32.dll", importc: "Shell_NotifyIconA".}
proc Shell_NotifyIconW*(dwMessage: Dword, lpData: PNOTIFYICONDATAW): bool{.
stdcall, dynlib: "shell32.dll", importc: "Shell_NotifyIconW".}
proc Shell_NotifyIcon*(dwMessage: Dword, lpData: PNOTIFYICONDATAA): bool{.
stdcall, dynlib: "shell32.dll", importc: "Shell_NotifyIconA".}
proc Shell_NotifyIcon*(dwMessage: Dword, lpData: PNOTIFYICONDATAW): bool{.
stdcall, dynlib: "shell32.dll", importc: "Shell_NotifyIconW".}
#
# The SHGetFileInfo API provides an easy way to get attributes
# for a file given a pathname.
#
# PARAMETERS
#
# pszPath file name to get info about
# dwFileAttributes file attribs, only used with SHGFI_USEFILEATTRIBUTES
# psfi place to return file info
# cbFileInfo size of structure
# uFlags flags
#
# RETURN
# TRUE if things worked
#
# out: icon
# out: icon index
# out: SFGAO_ flags
# out: display name (or path)
# out: type name
type
SHFILEINFOA* {.final.} = object
hIcon*: HICON # out: icon
iIcon*: int32 # out: icon index
dwAttributes*: DWORD # out: SFGAO_ flags
szDisplayName*: array[0..(MAX_PATH) - 1, char] # out: display name (or path)
szTypeName*: array[0..79, char] # out: type name
PSHFILEINFOA* = ptr SHFILEINFOA
SHFILEINFOW* {.final.} = object
hIcon*: HICON # out: icon
iIcon*: int32 # out: icon index
dwAttributes*: DWORD # out: SFGAO_ flags
szDisplayName*: array[0..(MAX_PATH) - 1, Wchar] # out: display name (or path)
szTypeName*: array[0..79, Wchar] # out: type name
PSHFILEINFOW* = ptr SHFILEINFOW
{.deprecated: [TSHFILEINFOA: SHFILEINFOA, TSHFILEINFOW: SHFILEINFOW].}
when defined(UNICODE):
type
SHFILEINFO* = SHFILEINFOW
pFILEINFO* = SHFILEINFOW
{.deprecated: [TSHFILEINFO: SHFILEINFOW].}
else:
type
SHFILEINFO* = SHFILEINFOA
pFILEINFO* = SHFILEINFOA
{.deprecated: [TSHFILEINFO: SHFILEINFOA].}
# NOTE: This is also in shlwapi.h. Please keep in synch.
const
SHGFI_ICON* = 0x00000100 # get Icon
SHGFI_DISPLAYNAME* = 0x00000200 # get display name
SHGFI_TYPENAME* = 0x00000400 # get type name
SHGFI_ATTRIBUTES* = 0x00000800 # get attributes
SHGFI_ICONLOCATION* = 0x00001000 # get icon location
SHGFI_EXETYPE* = 0x00002000 # return exe type
SHGFI_SYSICONINDEX* = 0x00004000 # get system icon index
SHGFI_LINKOVERLAY* = 0x00008000 # put a link overlay on icon
SHGFI_SELECTED* = 0x00010000 # show icon in selected state
SHGFI_ATTR_SPECIFIED* = 0x00020000 # get only specified attributes
SHGFI_LARGEICON* = 0x00000000 # get large icon
SHGFI_SMALLICON* = 0x00000001 # get small icon
SHGFI_OPENICON* = 0x00000002 # get open icon
SHGFI_SHELLICONSIZE* = 0x00000004 # get shell size icon
SHGFI_PIDL* = 0x00000008 # pszPath is a pidl
SHGFI_USEFILEATTRIBUTES* = 0x00000010 # use passed dwFileAttribute
SHGFI_ADDOVERLAYS* = 0x00000020 # apply the appropriate overlays
SHGFI_OVERLAYINDEX* = 0x00000040 # Get the index of the overlay
# in the upper 8 bits of the iIcon
proc SHGetFileInfoA*(pszPath: LPCSTR, dwFileAttributes: DWORD,
psfi: PSHFILEINFOA, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
proc SHGetFileInfoW*(pszPath: LPCWSTR, dwFileAttributes: DWORD,
psfi: PSHFILEINFOW, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoW".}
proc SHGetFileInfo*(pszPath: LPCSTR, dwFileAttributes: DWORD,
psfi: PSHFILEINFOA, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
proc SHGetFileInfoA*(pszPath: LPCSTR, dwFileAttributes: DWORD,
psfi: var SHFILEINFOA, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
proc SHGetFileInfoW*(pszPath: LPCWSTR, dwFileAttributes: DWORD,
psfi: var SHFILEINFOW, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoW".}
proc SHGetFileInfo*(pszPath: LPCSTR, dwFileAttributes: DWORD,
psfi: var SHFILEINFOA, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
proc SHGetFileInfo*(pszPath: LPCWSTR, dwFileAttributes: DWORD,
psfi: var SHFILEINFOW, cbFileInfo, UFlags: uint32): DWORD{.
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoW".}
proc SHGetDiskFreeSpaceExA*(pszDirectoryName: LPCSTR,
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExA".}
proc SHGetDiskFreeSpaceExW*(pszDirectoryName: LPCWSTR,
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExW".}
proc SHGetDiskFreeSpaceEx*(pszDirectoryName: LPCSTR,
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExA".}
proc SHGetDiskFreeSpace*(pszDirectoryName: LPCSTR,
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExA".}
proc SHGetDiskFreeSpaceEx*(pszDirectoryName: LPCWSTR,
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExW".}
proc SHGetDiskFreeSpace*(pszDirectoryName: LPCWSTR,
pulFreeBytesAvailableToCaller: PULARGE_INTEGER,
pulTotalNumberOfBytes: PULARGE_INTEGER,
pulTotalNumberOfFreeBytes: PULARGE_INTEGER): bool{.
stdcall, dynlib: "shell32.dll", importc: "SHGetDiskFreeSpaceExW".}
proc SHGetNewLinkInfoA*(pszLinkTo: LPCSTR, pszDir: LPCSTR, pszName: LPSTR,
pfMustCopy: PBool, uFlags: uint32): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoA".}
proc SHGetNewLinkInfoW*(pszLinkTo: LPCWSTR, pszDir: LPCWSTR, pszName: LPWSTR,
pfMustCopy: PBool, uFlags: uint32): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoW".}
proc SHGetNewLinkInfo*(pszLinkTo: LPCSTR, pszDir: LPCSTR, pszName: LPSTR,
pfMustCopy: PBool, uFlags: uint32): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoA".}
proc SHGetNewLinkInfo*(pszLinkTo: LPCWSTR, pszDir: LPCWSTR, pszName: LPWSTR,
pfMustCopy: PBool, uFlags: uint32): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoW".}
const
SHGNLI_PIDL* = 0x00000001 # pszLinkTo is a pidl
SHGNLI_PREFIXNAME* = 0x00000002 # Make name "Shortcut to xxx"
SHGNLI_NOUNIQUE* = 0x00000004 # don't do the unique name generation
SHGNLI_NOLNK* = 0x00000008 # don't add ".lnk" extension
PRINTACTION_OPEN* = 0
PRINTACTION_PROPERTIES* = 1
PRINTACTION_NETINSTALL* = 2
PRINTACTION_NETINSTALLLINK* = 3
PRINTACTION_TESTPAGE* = 4
PRINTACTION_OPENNETPRN* = 5
PRINTACTION_DOCUMENTDEFAULTS* = 6
PRINTACTION_SERVERPROPERTIES* = 7
proc SHInvokePrinterCommandA*(hwnd: HWND, uAction: uint32, lpBuf1: LPCSTR,
lpBuf2: LPCSTR, fModal: bool): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandA".}
proc SHInvokePrinterCommandW*(hwnd: HWND, uAction: uint32, lpBuf1: LPCWSTR,
lpBuf2: LPCWSTR, fModal: bool): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandW".}
proc SHInvokePrinterCommand*(hwnd: HWND, uAction: uint32, lpBuf1: LPCSTR,
lpBuf2: LPCSTR, fModal: bool): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandA".}
proc SHInvokePrinterCommand*(hwnd: HWND, uAction: uint32, lpBuf1: LPCWSTR,
lpBuf2: LPCWSTR, fModal: bool): bool{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandW".}
proc SHLoadNonloadedIconOverlayIdentifiers*(): HResult{.stdcall,
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandW".}
proc SHIsFileAvailableOffline*(pwszPath: LPCWSTR, pdwStatus: LPDWORD): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHIsFileAvailableOffline".}
const
OFFLINE_STATUS_LOCAL* = 0x00000001 # If open, it's open locally
OFFLINE_STATUS_REMOTE* = 0x00000002 # If open, it's open remotely
OFFLINE_STATUS_INCOMPLETE* = 0x00000004 # The local copy is currently incomplete.
# The file will not be available offline
# until it has been synchronized.
# sets the specified path to use the string resource
# as the UI instead of the file system name
proc SHSetLocalizedName*(pszPath: LPWSTR, pszResModule: LPCWSTR, idsRes: int32): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHSetLocalizedName".}
proc SHEnumerateUnreadMailAccountsA*(hKeyUser: HKEY, dwIndex: DWORD,
pszMailAddress: LPSTR,
cchMailAddress: int32): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHEnumerateUnreadMailAccountsA".}
proc SHEnumerateUnreadMailAccountsW*(hKeyUser: HKEY, dwIndex: DWORD,
pszMailAddress: LPWSTR,
cchMailAddress: int32): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHEnumerateUnreadMailAccountsW".}
proc SHEnumerateUnreadMailAccounts*(hKeyUser: HKEY, dwIndex: DWORD,
pszMailAddress: LPWSTR,
cchMailAddress: int32): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHEnumerateUnreadMailAccountsW".}
proc SHGetUnreadMailCountA*(hKeyUser: HKEY, pszMailAddress: LPCSTR,
pdwCount: PDWORD, pFileTime: PFILETIME,
pszShellExecuteCommand: LPSTR,
cchShellExecuteCommand: int32): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHGetUnreadMailCountA".}
proc SHGetUnreadMailCountW*(hKeyUser: HKEY, pszMailAddress: LPCWSTR,
pdwCount: PDWORD, pFileTime: PFILETIME,
pszShellExecuteCommand: LPWSTR,
cchShellExecuteCommand: int32): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHGetUnreadMailCountW".}
proc SHGetUnreadMailCount*(hKeyUser: HKEY, pszMailAddress: LPCSTR,
pdwCount: PDWORD, pFileTime: PFILETIME,
pszShellExecuteCommand: LPSTR,
cchShellExecuteCommand: int32): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHGetUnreadMailCountA".}
proc SHGetUnreadMailCount*(hKeyUser: HKEY, pszMailAddress: LPCWSTR,
pdwCount: PDWORD, pFileTime: PFILETIME,
pszShellExecuteCommand: LPWSTR,
cchShellExecuteCommand: int32): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHGetUnreadMailCountW".}
proc SHSetUnreadMailCountA*(pszMailAddress: LPCSTR, dwCount: DWORD,
pszShellExecuteCommand: LPCSTR): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHSetUnreadMailCountA".}
proc SHSetUnreadMailCountW*(pszMailAddress: LPCWSTR, dwCount: DWORD,
pszShellExecuteCommand: LPCWSTR): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHSetUnreadMailCountW".}
proc SHSetUnreadMailCount*(pszMailAddress: LPCSTR, dwCount: DWORD,
pszShellExecuteCommand: LPCSTR): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHSetUnreadMailCountA".}
proc SHSetUnreadMailCount*(pszMailAddress: LPCWSTR, dwCount: DWORD,
pszShellExecuteCommand: LPCWSTR): HRESULT{.stdcall,
dynlib: "shell32.dll", importc: "SHSetUnreadMailCountW".}
proc SHGetImageList*(iImageList: int32, riid: TIID, ppvObj: ptr pointer): HRESULT{.
stdcall, dynlib: "shell32.dll", importc: "SHGetImageList".}
const
SHIL_LARGE* = 0 # normally 32x32
SHIL_SMALL* = 1 # normally 16x16
SHIL_EXTRALARGE* = 2
SHIL_SYSSMALL* = 3 # like SHIL_SMALL, but tracks system small icon metric correctly
SHIL_LAST* = SHIL_SYSSMALL
# implementation
proc EIRESID(x: int32): int32 =
result = -x

View File

@@ -1,93 +0,0 @@
#
#
# Nim's Runtime Library
# (c) Copyright 2006 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# ---------------------------------------------------------------------
# shfolder.dll is distributed standard with IE5.5, so it should ship
# with 2000/XP or higher but is likely to be installed on NT/95/98 or
# ME as well. It works on all these systems.
#
# The info found here is also in the registry:
# HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\
# HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\
#
# Note that not all CSIDL_* constants are supported by shlfolder.dll,
# they should be supported by the shell32.dll, though again not on all
# systems.
# ---------------------------------------------------------------------
{.deadCodeElim: on.}
import
windows
const
LibName* = "SHFolder.dll"
const
CSIDL_PROGRAMS* = 0x00000002 # %SYSTEMDRIVE%\Program Files
CSIDL_PERSONAL* = 0x00000005 # %USERPROFILE%\My Documents
CSIDL_FAVORITES* = 0x00000006 # %USERPROFILE%\Favorites
CSIDL_STARTUP* = 0x00000007 # %USERPROFILE%\Start menu\Programs\Startup
CSIDL_RECENT* = 0x00000008 # %USERPROFILE%\Recent
CSIDL_SENDTO* = 0x00000009 # %USERPROFILE%\Sendto
CSIDL_STARTMENU* = 0x0000000B # %USERPROFILE%\Start menu
CSIDL_MYMUSIC* = 0x0000000D # %USERPROFILE%\Documents\My Music
CSIDL_MYVIDEO* = 0x0000000E # %USERPROFILE%\Documents\My Videos
CSIDL_DESKTOPDIRECTORY* = 0x00000010 # %USERPROFILE%\Desktop
CSIDL_NETHOOD* = 0x00000013 # %USERPROFILE%\NetHood
CSIDL_TEMPLATES* = 0x00000015 # %USERPROFILE%\Templates
CSIDL_COMMON_STARTMENU* = 0x00000016 # %PROFILEPATH%\All users\Start menu
CSIDL_COMMON_PROGRAMS* = 0x00000017 # %PROFILEPATH%\All users\Start menu\Programs
CSIDL_COMMON_STARTUP* = 0x00000018 # %PROFILEPATH%\All users\Start menu\Programs\Startup
CSIDL_COMMON_DESKTOPDIRECTORY* = 0x00000019 # %PROFILEPATH%\All users\Desktop
CSIDL_APPDATA* = 0x0000001A # %USERPROFILE%\Application Data (roaming)
CSIDL_PRINTHOOD* = 0x0000001B # %USERPROFILE%\Printhood
CSIDL_LOCAL_APPDATA* = 0x0000001C # %USERPROFILE%\Local Settings\Application Data (non roaming)
CSIDL_COMMON_FAVORITES* = 0x0000001F # %PROFILEPATH%\All users\Favorites
CSIDL_INTERNET_CACHE* = 0x00000020 # %USERPROFILE%\Local Settings\Temporary Internet Files
CSIDL_COOKIES* = 0x00000021 # %USERPROFILE%\Cookies
CSIDL_HISTORY* = 0x00000022 # %USERPROFILE%\Local settings\History
CSIDL_COMMON_APPDATA* = 0x00000023 # %PROFILESPATH%\All Users\Application Data
CSIDL_WINDOWS* = 0x00000024 # %SYSTEMROOT%
CSIDL_SYSTEM* = 0x00000025 # %SYSTEMROOT%\SYSTEM32 (may be system on 95/98/ME)
CSIDL_PROGRAM_FILES* = 0x00000026 # %SYSTEMDRIVE%\Program Files
CSIDL_MYPICTURES* = 0x00000027 # %USERPROFILE%\My Documents\My Pictures
CSIDL_PROFILE* = 0x00000028 # %USERPROFILE%
CSIDL_PROGRAM_FILES_COMMON* = 0x0000002B # %SYSTEMDRIVE%\Program Files\Common
CSIDL_COMMON_TEMPLATES* = 0x0000002D # %PROFILEPATH%\All Users\Templates
CSIDL_COMMON_DOCUMENTS* = 0x0000002E # %PROFILEPATH%\All Users\Documents
CSIDL_COMMON_ADMINTOOLS* = 0x0000002F # %PROFILEPATH%\All Users\Start Menu\Programs\Administrative Tools
CSIDL_ADMINTOOLS* = 0x00000030 # %USERPROFILE%\Start Menu\Programs\Administrative Tools
CSIDL_COMMON_MUSIC* = 0x00000035 # %PROFILEPATH%\All Users\Documents\my music
CSIDL_COMMON_PICTURES* = 0x00000036 # %PROFILEPATH%\All Users\Documents\my pictures
CSIDL_COMMON_VIDEO* = 0x00000037 # %PROFILEPATH%\All Users\Documents\my videos
CSIDL_CDBURN_AREA* = 0x0000003B # %USERPROFILE%\Local Settings\Application Data\Microsoft\CD Burning
CSIDL_PROFILES* = 0x0000003E # %PROFILEPATH%
CSIDL_FLAG_CREATE* = 0x00008000 # (force creation of requested folder if it doesn't exist yet)
# Original entry points
proc SHGetFolderPathA*(Ahwnd: HWND, Csidl: int, Token: Handle, Flags: DWord,
Path: cstring): HRESULT{.stdcall, dynlib: LibName,
importc: "SHGetFolderPathA".}
proc SHGetFolderPathW*(Ahwnd: HWND, Csidl: int, Token: Handle, Flags: DWord,
Path: cstring): HRESULT{.stdcall, dynlib: LibName,
importc: "SHGetFolderPathW".}
proc SHGetFolderPath*(Ahwnd: HWND, Csidl: int, Token: Handle, Flags: DWord,
Path: cstring): HRESULT{.stdcall, dynlib: LibName,
importc: "SHGetFolderPathA".}
type
PFNSHGetFolderPathA* = proc (Ahwnd: HWND, Csidl: int, Token: Handle,
Flags: DWord, Path: cstring): HRESULT{.stdcall.}
PFNSHGetFolderPathW* = proc (Ahwnd: HWND, Csidl: int, Token: Handle,
Flags: DWord, Path: cstring): HRESULT{.stdcall.}
PFNSHGetFolderPath* = PFNSHGetFolderPathA
{.deprecated: [TSHGetFolderPathA: PFNSHGetFolderPathA,
TSHGetFolderPathW: PFNSHGetFolderPathW,
TSHGetFolderPath: SHGetFolderPathA].}

File diff suppressed because it is too large Load Diff