mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 03:32:32 +00:00
9
examples/wingui.nim
Normal file
9
examples/wingui.nim
Normal file
@@ -0,0 +1,9 @@
|
||||
# test a Windows GUI application
|
||||
|
||||
import
|
||||
windows, shellapi, nb30, mmsystem, shfolder
|
||||
|
||||
#proc MessageBox(hWnd: int, lpText, lpCaption: CString, uType: uint): int
|
||||
# {stdcall, import: "MessageBox", header: "<windows.h>"}
|
||||
|
||||
discard MessageBox(0, "Hello World!", "Nimrod GUI Application", 0)
|
||||
2655
lib/windows/mmsystem.nim
Normal file
2655
lib/windows/mmsystem.nim
Normal file
File diff suppressed because it is too large
Load Diff
232
lib/windows/nb30.nim
Normal file
232
lib/windows/nb30.nim
Normal file
@@ -0,0 +1,232 @@
|
||||
#
|
||||
#
|
||||
# Nimrod'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 TNCB
|
||||
TNCBPostProc* = proc (P: PNCB) {.stdcall.}
|
||||
TNCB* {.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*: TNCBPostProc # 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*: THandle # HANDLE to Win32 event which
|
||||
# will be set to the signalled
|
||||
# state when an ASYNCH command
|
||||
# completes
|
||||
|
||||
PAdapterStatus* = ptr TAdapterStatus
|
||||
TAdapterStatus* {.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 TNameBuffer
|
||||
TNameBuffer* {.final.} = object
|
||||
name*: array[0..NCBNAMSZ - 1, Char]
|
||||
name_num*: Char
|
||||
name_flags*: Char
|
||||
|
||||
|
||||
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 TSessionHeader
|
||||
TSessionHeader* {.final.} = object
|
||||
sess_name*: Char
|
||||
num_sess*: Char
|
||||
rcv_dg_outstanding*: Char
|
||||
rcv_any_outstanding*: Char
|
||||
|
||||
PSessionBuffer* = ptr TSessionBuffer
|
||||
TSessionBuffer* {.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
|
||||
|
||||
|
||||
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 TFindNameHeader
|
||||
TFindNameHeader* {.final.} = object
|
||||
node_count*: int16
|
||||
reserved*: Char
|
||||
unique_group*: Char
|
||||
|
||||
PFindNameBuffer* = ptr TFindNameBuffer
|
||||
TFindNameBuffer* {.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 TActionHeader
|
||||
TActionHeader* {.final.} = object
|
||||
transport_id*: int32
|
||||
action_code*: int16
|
||||
reserved*: int16
|
||||
|
||||
|
||||
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
|
||||
208
lib/windows/ole2.nim
Normal file
208
lib/windows/ole2.nim
Normal file
@@ -0,0 +1,208 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2006 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
import
|
||||
windows
|
||||
|
||||
const
|
||||
GUID_NULL*: TGUID = (D1: 0x00000000, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000])
|
||||
IID_IUnknown*: TGUID = (D1: 0x00000000, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IClassFactory*: TGUID = (D1: 0x00000001, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IMarshal*: TGUID = (D1: 0x00000003, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IMalloc*: TGUID = (D1: 0x00000002, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IStdMarshalInfo*: TGUID = (D1: 0x00000018, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IExternalConnection*: TGUID = (D1: 0x00000019, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IEnumUnknown*: TGUID = (D1: 0x00000100, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IBindCtx*: TGUID = (D1: 0x0000000E, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IEnumMoniker*: TGUID = (D1: 0x00000102, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IRunnableObject*: TGUID = (D1: 0x00000126, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IRunningObjectTable*: TGUID = (D1: 0x00000010, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IPersist*: TGUID = (D1: 0x0000010C, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IPersistStream*: TGUID = (D1: 0x00000109, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IMoniker*: TGUID = (D1: 0x0000000F, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IEnumString*: TGUID = (D1: 0x00000101, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IStream*: TGUID = (D1: 0x0000000C, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IEnumStatStg*: TGUID = (D1: 0x0000000D, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IStorage*: TGUID = (D1: 0x0000000B, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IPersistFile*: TGUID = (D1: 0x0000010B, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IPersistStorage*: TGUID = (D1: 0x0000010A, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_ILockBytes*: TGUID = (D1: 0x0000000A, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IEnumFormatEtc*: TGUID = (D1: 0x00000103, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IEnumStatData*: TGUID = (D1: 0x00000105, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IRootStorage*: TGUID = (D1: 0x00000012, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IAdviseSink*: TGUID = (D1: 0x0000010F, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IAdviseSink2*: TGUID = (D1: 0x00000125, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IDataObject*: TGUID = (D1: 0x0000010E, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IDataAdviseHolder*: TGUID = (D1: 0x00000110, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IMessageFilter*: TGUID = (D1: 0x00000016, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IRpcChannelBuffer*: TGUID = (D1: 0xD5F56B60, D2: 0x0000593B,
|
||||
D3: 0x0000101A, D4: [0x000000B5, 0x00000069, 0x00000008, 0x00000000,
|
||||
0x0000002B, 0x0000002D, 0x000000BF, 0x0000007A])
|
||||
IID_IRpcProxyBuffer*: TGUID = (D1: 0xD5F56A34, D2: 0x0000593B, D3: 0x0000101A, D4: [
|
||||
0x000000B5, 0x00000069, 0x00000008, 0x00000000, 0x0000002B, 0x0000002D,
|
||||
0x000000BF, 0x0000007A])
|
||||
IID_IRpcStubBuffer*: TGUID = (D1: 0xD5F56AFC, D2: 0x0000593B, D3: 0x0000101A, D4: [
|
||||
0x000000B5, 0x00000069, 0x00000008, 0x00000000, 0x0000002B, 0x0000002D,
|
||||
0x000000BF, 0x0000007A])
|
||||
IID_IPSFactoryBuffer*: TGUID = (D1: 0xD5F569D0, D2: 0x0000593B,
|
||||
D3: 0x0000101A, D4: [0x000000B5, 0x00000069, 0x00000008, 0x00000000,
|
||||
0x0000002B, 0x0000002D, 0x000000BF, 0x0000007A])
|
||||
IID_ICreateTypeInfo*: TGUID = (D1: 0x00020405, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_ICreateTypeLib*: TGUID = (D1: 0x00020406, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IDispatch*: TGUID = (D1: 0x00020400, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IEnumVariant*: TGUID = (D1: 0x00020404, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_ITypeComp*: TGUID = (D1: 0x00020403, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_ITypeInfo*: TGUID = (D1: 0x00020401, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_ITypeLib*: TGUID = (D1: 0x00020402, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IErrorInfo*: TGUID = (D1: 0x1CF2B120, D2: 0x0000547D, D3: 0x0000101B, D4: [
|
||||
0x0000008E, 0x00000065, 0x00000008, 0x00000000, 0x0000002B, 0x0000002B,
|
||||
0x000000D1, 0x00000019])
|
||||
IID_ICreateErrorInfo*: TGUID = (D1: 0x22F03340, D2: 0x0000547D,
|
||||
D3: 0x0000101B, D4: [0x0000008E, 0x00000065, 0x00000008, 0x00000000,
|
||||
0x0000002B, 0x0000002B, 0x000000D1, 0x00000019])
|
||||
IID_ISupportErrorInfo*: TGUID = (D1: 0xDF0B3D60, D2: 0x0000548F,
|
||||
D3: 0x0000101B, D4: [0x0000008E, 0x00000065, 0x00000008, 0x00000000,
|
||||
0x0000002B, 0x0000002B, 0x000000D1, 0x00000019])
|
||||
IID_IOleAdviseHolder*: TGUID = (D1: 0x00000111, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IOleCache*: TGUID = (D1: 0x0000011E, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IOleCache2*: TGUID = (D1: 0x00000128, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IOleCacheControl*: TGUID = (D1: 0x00000129, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IParseDisplayName*: TGUID = (D1: 0x0000011A, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IOleContainer*: TGUID = (D1: 0x0000011B, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IOleClientSite*: TGUID = (D1: 0x00000118, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IOleObject*: TGUID = (D1: 0x00000112, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IOleWindow*: TGUID = (D1: 0x00000114, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IOleLink*: TGUID = (D1: 0x0000011D, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IOleItemContainer*: TGUID = (D1: 0x0000011C, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IOleInPlaceUIWindow*: TGUID = (D1: 0x00000115, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IOleInPlaceActiveObject*: TGUID = (D1: 0x00000117, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IOleInPlaceFrame*: TGUID = (D1: 0x00000116, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IOleInPlaceObject*: TGUID = (D1: 0x00000113, D2: 0x00000000,
|
||||
D3: 0x00000000, D4: [0x000000C0, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000046])
|
||||
IID_IOleInPlaceSite*: TGUID = (D1: 0x00000119, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IViewObject*: TGUID = (D1: 0x0000010D, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IViewObject2*: TGUID = (D1: 0x00000127, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IDropSource*: TGUID = (D1: 0x00000121, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IDropTarget*: TGUID = (D1: 0x00000122, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
IID_IEnumOleVerb*: TGUID = (D1: 0x00000104, D2: 0x00000000, D3: 0x00000000, D4: [
|
||||
0x000000C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000046])
|
||||
202
lib/windows/psapi.nim
Normal file
202
lib/windows/psapi.nim
Normal file
@@ -0,0 +1,202 @@
|
||||
#
|
||||
#
|
||||
# Nimrod'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".}
|
||||
863
lib/windows/shellapi.nim
Normal file
863
lib/windows/shellapi.nim
Normal file
@@ -0,0 +1,863 @@
|
||||
#
|
||||
#
|
||||
# Nimrod'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* = THandle
|
||||
UINT_PTR* = ptr UINT
|
||||
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
|
||||
TSTARTUPINFOW* = STARTUPINFOW
|
||||
PSTARTUPINFOW* = ptr STARTUPINFOW #unicode
|
||||
|
||||
proc DragQueryFileA*(arg1: HDROP, arg2: UINT, arg3: LPSTR, arg4: UINT): UINT{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileA".}
|
||||
proc DragQueryFileW*(arg1: HDROP, arg2: UINT, arg3: LPWSTR, arg4: UINT): UINT{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileW".}
|
||||
proc DragQueryFile*(arg1: HDROP, arg2: UINT, arg3: LPSTR, arg4: UINT): UINT{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "DragQueryFileA".}
|
||||
proc DragQueryFile*(arg1: HDROP, arg2: UINT, arg3: LPWSTR, arg4: UINT): UINT{.
|
||||
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: UINT): HICON{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "ExtractIconA".}
|
||||
proc ExtractIconW*(hInst: HINST, lpszExeFileName: LPCWSTR, nIconIndex: UINT): HICON{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "ExtractIconW".}
|
||||
proc ExtractIcon*(hInst: HINST, lpszExeFileName: LPCSTR, nIconIndex: UINT): HICON{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "ExtractIconA".}
|
||||
proc ExtractIcon*(hInst: HINST, lpszExeFileName: LPCWSTR, nIconIndex: UINT): HICON{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "ExtractIconW".}
|
||||
# if(WINVER >= 0x0400)
|
||||
type # init with sizeof(DRAGINFO)
|
||||
DRAGINFOA* {.final.} = object
|
||||
uSize*: UINT
|
||||
pt*: POINT
|
||||
fNC*: BOOL
|
||||
lpFileList*: LPSTR
|
||||
grfKeyState*: DWORD
|
||||
|
||||
TDRAGINFOA* = DRAGINFOA
|
||||
LPDRAGINFOA* = ptr DRAGINFOA # init with sizeof(DRAGINFO)
|
||||
DRAGINFOW* {.final.} = object
|
||||
uSize*: UINT
|
||||
pt*: POINT
|
||||
fNC*: BOOL
|
||||
lpFileList*: LPWSTR
|
||||
grfKeyState*: DWORD
|
||||
|
||||
TDRAGINFOW* = DRAGINFOW
|
||||
LPDRAGINFOW* = ptr DRAGINFOW
|
||||
|
||||
when defined(UNICODE):
|
||||
type
|
||||
DRAGINFO* = DRAGINFOW
|
||||
TDRAGINFO* = DRAGINFOW
|
||||
LPDRAGINFO* = LPDRAGINFOW
|
||||
else:
|
||||
type
|
||||
DRAGINFO* = DRAGINFOA
|
||||
TDRAGINFO* = DRAGINFOW
|
||||
LPDRAGINFO* = LPDRAGINFOA
|
||||
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*: UINT
|
||||
uEdge*: UINT
|
||||
rc*: RECT
|
||||
lParam*: LPARAM # message specific
|
||||
|
||||
TAPPBARDATA* = AppBarData
|
||||
PAPPBARDATA* = ptr AppBarData
|
||||
|
||||
proc SHAppBarMessage*(dwMessage: DWORD, pData: APPBARDATA): UINT_PTR{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "SHAppBarMessage".}
|
||||
#
|
||||
# EndAppBar
|
||||
#
|
||||
proc DoEnvironmentSubstA*(szString: LPSTR, cchString: UINT): DWORD{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "DoEnvironmentSubstA".}
|
||||
proc DoEnvironmentSubstW*(szString: LPWSTR, cchString: UINT): DWORD{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "DoEnvironmentSubstW".}
|
||||
proc DoEnvironmentSubst*(szString: LPSTR, cchString: UINT): DWORD{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "DoEnvironmentSubstA".}
|
||||
proc DoEnvironmentSubst*(szString: LPWSTR, cchString: UINT): DWORD{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "DoEnvironmentSubstW".}
|
||||
#Macro
|
||||
proc EIRESID*(x: int32): int32
|
||||
proc ExtractIconExA*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: pHICON,
|
||||
phiconSmall: pHIcon, nIcons: UINT): UINT{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "ExtractIconExA".}
|
||||
proc ExtractIconExW*(lpszFile: LPCWSTR, nIconIndex: int32, phiconLarge: pHICON,
|
||||
phiconSmall: pHIcon, nIcons: UINT): UINT{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "ExtractIconExW".}
|
||||
proc ExtractIconExA*(lpszFile: LPCSTR, nIconIndex: int32,
|
||||
phiconLarge: var HICON, phiconSmall: var HIcon,
|
||||
nIcons: UINT): UINT{.stdcall, dynlib: "shell32.dll",
|
||||
importc: "ExtractIconExA".}
|
||||
proc ExtractIconExW*(lpszFile: LPCWSTR, nIconIndex: int32,
|
||||
phiconLarge: var HICON, phiconSmall: var HIcon,
|
||||
nIcons: UINT): UINT{.stdcall, dynlib: "shell32.dll",
|
||||
importc: "ExtractIconExW".}
|
||||
proc ExtractIconEx*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: pHICON,
|
||||
phiconSmall: pHIcon, nIcons: UINT): UINT{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "ExtractIconExA".}
|
||||
proc ExtractIconEx*(lpszFile: LPCWSTR, nIconIndex: int32, phiconLarge: pHICON,
|
||||
phiconSmall: pHIcon, nIcons: UINT): UINT{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "ExtractIconExW".}
|
||||
proc ExtractIconEx*(lpszFile: LPCSTR, nIconIndex: int32, phiconLarge: var HICON,
|
||||
phiconSmall: var HIcon, nIcons: UINT): UINT{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "ExtractIconExA".}
|
||||
proc ExtractIconEx*(lpszFile: LPCWSTR, nIconIndex: int32,
|
||||
phiconLarge: var HICON, phiconSmall: var HIcon, nIcons: UINT): UINT{.
|
||||
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*: UINT
|
||||
pFrom*: LPCSTR
|
||||
pTo*: LPCSTR
|
||||
fFlags*: FILEOP_FLAGS
|
||||
fAnyOperationsAborted*: BOOL
|
||||
hNameMappings*: LPVOID
|
||||
lpszProgressTitle*: LPCSTR # only used if FOF_SIMPLEPROGRESS
|
||||
|
||||
TSHFILEOPSTRUCTA* = SHFILEOPSTRUCTA
|
||||
LPSHFILEOPSTRUCTA* = ptr SHFILEOPSTRUCTA
|
||||
SHFILEOPSTRUCTW* {.final.} = object
|
||||
hwnd*: HWND
|
||||
wFunc*: UINT
|
||||
pFrom*: LPCWSTR
|
||||
pTo*: LPCWSTR
|
||||
fFlags*: FILEOP_FLAGS
|
||||
fAnyOperationsAborted*: BOOL
|
||||
hNameMappings*: LPVOID
|
||||
lpszProgressTitle*: LPCWSTR
|
||||
|
||||
TSHFILEOPSTRUCTW* = SHFILEOPSTRUCTW
|
||||
LPSHFILEOPSTRUCTW* = ptr SHFILEOPSTRUCTW
|
||||
|
||||
when defined(UNICODE):
|
||||
type
|
||||
SHFILEOPSTRUCT* = SHFILEOPSTRUCTW
|
||||
TSHFILEOPSTRUCT* = SHFILEOPSTRUCTW
|
||||
LPSHFILEOPSTRUCT* = LPSHFILEOPSTRUCTW
|
||||
else:
|
||||
type
|
||||
SHFILEOPSTRUCT* = SHFILEOPSTRUCTA
|
||||
TSHFILEOPSTRUCT* = SHFILEOPSTRUCTA
|
||||
LPSHFILEOPSTRUCT* = LPSHFILEOPSTRUCTA
|
||||
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: THandle){.stdcall,
|
||||
dynlib: "shell32.dll", importc: "SHFreeNameMappings".}
|
||||
type
|
||||
SHNAMEMAPPINGA* {.final.} = object
|
||||
pszOldPath*: LPSTR
|
||||
pszNewPath*: LPSTR
|
||||
cchOldPath*: int32
|
||||
cchNewPath*: int32
|
||||
|
||||
TSHNAMEMAPPINGA* = SHNAMEMAPPINGA
|
||||
LPSHNAMEMAPPINGA* = ptr SHNAMEMAPPINGA
|
||||
SHNAMEMAPPINGW* {.final.} = object
|
||||
pszOldPath*: LPWSTR
|
||||
pszNewPath*: LPWSTR
|
||||
cchOldPath*: int32
|
||||
cchNewPath*: int32
|
||||
|
||||
TSHNAMEMAPPINGW* = SHNAMEMAPPINGW
|
||||
LPSHNAMEMAPPINGW* = ptr SHNAMEMAPPINGW
|
||||
|
||||
when not(defined(UNICODE)):
|
||||
type
|
||||
SHNAMEMAPPING* = SHNAMEMAPPINGW
|
||||
TSHNAMEMAPPING* = SHNAMEMAPPINGW
|
||||
LPSHNAMEMAPPING* = LPSHNAMEMAPPINGW
|
||||
else:
|
||||
type
|
||||
SHNAMEMAPPING* = SHNAMEMAPPINGA
|
||||
TSHNAMEMAPPING* = SHNAMEMAPPINGA
|
||||
LPSHNAMEMAPPING* = LPSHNAMEMAPPINGA
|
||||
#
|
||||
# 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
|
||||
|
||||
TSHELLEXECUTEINFOA* = SHELLEXECUTEINFOA
|
||||
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
|
||||
|
||||
TSHELLEXECUTEINFOW* = SHELLEXECUTEINFOW
|
||||
LPSHELLEXECUTEINFOW* = ptr SHELLEXECUTEINFOW
|
||||
|
||||
when defined(UNICODE):
|
||||
type
|
||||
SHELLEXECUTEINFO* = SHELLEXECUTEINFOW
|
||||
TSHELLEXECUTEINFO* = SHELLEXECUTEINFOW
|
||||
LPSHELLEXECUTEINFO* = LPSHELLEXECUTEINFOW
|
||||
else:
|
||||
type
|
||||
SHELLEXECUTEINFO* = SHELLEXECUTEINFOA
|
||||
TSHELLEXECUTEINFO* = SHELLEXECUTEINFOA
|
||||
LPSHELLEXECUTEINFO* = LPSHELLEXECUTEINFOA
|
||||
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
|
||||
|
||||
TSHCREATEPROCESSINFOW* = SHCREATEPROCESSINFOW
|
||||
PSHCREATEPROCESSINFOW* = ptr 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
|
||||
|
||||
TSHQUERYRBINFO* = SHQUERYRBINFO
|
||||
LPSHQUERYRBINFO* = ptr SHQUERYRBINFO # flags for SHEmptyRecycleBin
|
||||
|
||||
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*: UINT
|
||||
uFlags*: UINT
|
||||
uCallbackMessage*: UINT
|
||||
hIcon*: HICON
|
||||
szTip*: array[0..127, CHAR]
|
||||
dwState*: DWORD
|
||||
dwStateMask*: DWORD
|
||||
szInfo*: array[0..255, CHAR]
|
||||
uTimeout*: UINT # also: uVersion
|
||||
szInfoTitle*: array[0..63, CHAR]
|
||||
dwInfoFlags*: DWORD
|
||||
guidItem*: TGUID
|
||||
|
||||
TNOTIFYICONDATAA* = NOTIFYICONDATAA
|
||||
PNOTIFYICONDATAA* = ptr NOTIFYICONDATAA
|
||||
NOTIFYICONDATAW* {.final.} = object
|
||||
cbSize*: DWORD
|
||||
hWnd*: HWND
|
||||
uID*: UINT
|
||||
uFlags*: UINT
|
||||
uCallbackMessage*: UINT
|
||||
hIcon*: HICON
|
||||
szTip*: array[0..127, WCHAR]
|
||||
dwState*: DWORD
|
||||
dwStateMask*: DWORD
|
||||
szInfo*: array[0..255, WCHAR]
|
||||
uTimeout*: UINT # also uVersion : UINT
|
||||
szInfoTitle*: array[0..63, CHAR]
|
||||
dwInfoFlags*: DWORD
|
||||
guidItem*: TGUID
|
||||
|
||||
TNOTIFYICONDATAW* = NOTIFYICONDATAW
|
||||
PNOTIFYICONDATAW* = ptr NOTIFYICONDATAW
|
||||
|
||||
when defined(UNICODE):
|
||||
type
|
||||
NOTIFYICONDATA* = NOTIFYICONDATAW
|
||||
TNOTIFYICONDATA* = NOTIFYICONDATAW
|
||||
PNOTIFYICONDATA* = PNOTIFYICONDATAW
|
||||
else:
|
||||
type
|
||||
NOTIFYICONDATA* = NOTIFYICONDATAA
|
||||
TNOTIFYICONDATA* = NOTIFYICONDATAA
|
||||
PNOTIFYICONDATA* = PNOTIFYICONDATAA
|
||||
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
|
||||
|
||||
TSHFILEINFOA* = SHFILEINFOA
|
||||
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
|
||||
|
||||
TSHFILEINFOW* = SHFILEINFOW
|
||||
pSHFILEINFOW* = ptr SHFILEINFOW
|
||||
|
||||
when defined(UNICODE):
|
||||
type
|
||||
SHFILEINFO* = SHFILEINFOW
|
||||
TSHFILEINFO* = SHFILEINFOW
|
||||
pFILEINFO* = SHFILEINFOW
|
||||
else:
|
||||
type
|
||||
SHFILEINFO* = SHFILEINFOA
|
||||
TSHFILEINFO* = SHFILEINFOA
|
||||
pFILEINFO* = 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: UINT): DWORD{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
|
||||
proc SHGetFileInfoW*(pszPath: LPCWSTR, dwFileAttributes: DWORD,
|
||||
psfi: pSHFILEINFOW, cbFileInfo, UFlags: UINT): DWORD{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoW".}
|
||||
proc SHGetFileInfo*(pszPath: LPCSTR, dwFileAttributes: DWORD,
|
||||
psfi: pSHFILEINFOA, cbFileInfo, UFlags: UINT): DWORD{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
|
||||
proc SHGetFileInfoA*(pszPath: LPCSTR, dwFileAttributes: DWORD,
|
||||
psfi: var TSHFILEINFOA, cbFileInfo, UFlags: UINT): DWORD{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
|
||||
proc SHGetFileInfoW*(pszPath: LPCWSTR, dwFileAttributes: DWORD,
|
||||
psfi: var TSHFILEINFOW, cbFileInfo, UFlags: UINT): DWORD{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoW".}
|
||||
proc SHGetFileInfo*(pszPath: LPCSTR, dwFileAttributes: DWORD,
|
||||
psfi: var TSHFILEINFOA, cbFileInfo, UFlags: UINT): DWORD{.
|
||||
stdcall, dynlib: "shell32.dll", importc: "SHGetFileInfoA".}
|
||||
proc SHGetFileInfo*(pszPath: LPCWSTR, dwFileAttributes: DWORD,
|
||||
psfi: var TSHFILEINFOW, cbFileInfo, UFlags: UINT): 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: UINT): Bool{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoA".}
|
||||
proc SHGetNewLinkInfoW*(pszLinkTo: LPCWSTR, pszDir: LPCWSTR, pszName: LPWSTR,
|
||||
pfMustCopy: pBool, uFlags: UINT): Bool{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoW".}
|
||||
proc SHGetNewLinkInfo*(pszLinkTo: LPCSTR, pszDir: LPCSTR, pszName: LPSTR,
|
||||
pfMustCopy: pBool, uFlags: UINT): Bool{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "SHGetNewLinkInfoA".}
|
||||
proc SHGetNewLinkInfo*(pszLinkTo: LPCWSTR, pszDir: LPCWSTR, pszName: LPWSTR,
|
||||
pfMustCopy: pBool, uFlags: UINT): 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: UINT, lpBuf1: LPCSTR,
|
||||
lpBuf2: LPCSTR, fModal: Bool): Bool{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandA".}
|
||||
proc SHInvokePrinterCommandW*(HWND: hwnd, uAction: UINT, lpBuf1: LPCWSTR,
|
||||
lpBuf2: LPCWSTR, fModal: Bool): Bool{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandW".}
|
||||
proc SHInvokePrinterCommand*(HWND: hwnd, uAction: UINT, lpBuf1: LPCSTR,
|
||||
lpBuf2: LPCSTR, fModal: Bool): Bool{.stdcall,
|
||||
dynlib: "shell32.dll", importc: "SHInvokePrinterCommandA".}
|
||||
proc SHInvokePrinterCommand*(HWND: hwnd, uAction: UINT, 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
|
||||
93
lib/windows/shfolder.nim
Normal file
93
lib/windows/shfolder.nim
Normal file
@@ -0,0 +1,93 @@
|
||||
#
|
||||
#
|
||||
# Nimrod'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: THandle, Flags: DWord,
|
||||
Path: cstring): HRESULT{.stdcall, dynlib: LibName,
|
||||
importc: "SHGetFolderPathA".}
|
||||
proc SHGetFolderPathW*(Ahwnd: HWND, Csidl: int, Token: THandle, Flags: DWord,
|
||||
Path: cstring): HRESULT{.stdcall, dynlib: LibName,
|
||||
importc: "SHGetFolderPathW".}
|
||||
proc SHGetFolderPath*(Ahwnd: HWND, Csidl: int, Token: THandle, Flags: DWord,
|
||||
Path: cstring): HRESULT{.stdcall, dynlib: LibName,
|
||||
importc: "SHGetFolderPathA".}
|
||||
type
|
||||
PFNSHGetFolderPathA* = proc (Ahwnd: HWND, Csidl: int, Token: THandle,
|
||||
Flags: DWord, Path: cstring): HRESULT{.stdcall.}
|
||||
PFNSHGetFolderPathW* = proc (Ahwnd: HWND, Csidl: int, Token: THandle,
|
||||
Flags: DWord, Path: cstring): HRESULT{.stdcall.}
|
||||
PFNSHGetFolderPath* = PFNSHGetFolderPathA
|
||||
TSHGetFolderPathA* = PFNSHGetFolderPathA
|
||||
TSHGetFolderPathW* = PFNSHGetFolderPathW
|
||||
TSHGetFolderPath* = TSHGetFolderPathA
|
||||
|
||||
23945
lib/windows/windows.nim
Normal file
23945
lib/windows/windows.nim
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user