summaryrefslogtreecommitdiff
path: root/plugins/ShlExt
diff options
context:
space:
mode:
authorAlexey Kulakov <panda75@bk.ru>2012-06-29 20:46:12 +0000
committerAlexey Kulakov <panda75@bk.ru>2012-06-29 20:46:12 +0000
commit187798bdd5c9d1c917b6c22ea6c083e73ac36276 (patch)
treee458e2bd5a0cca5822aa0c72b163b8711335e4ba /plugins/ShlExt
parentd8f1c974528897e63f0a0b3c873e6e30a319f88f (diff)
pascal headers updated, testdll added
ShlExt: types fixes, compiling to 64 bit now (not sure what will work btw) TopToolBar: some load-save things changes git-svn-id: http://svn.miranda-ng.org/main/trunk@689 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ShlExt')
-rw-r--r--plugins/ShlExt/shlc.inc23
-rw-r--r--plugins/ShlExt/shlcom.pas106
-rw-r--r--plugins/ShlExt/shlext.dpr101
-rw-r--r--plugins/ShlExt/shlicons.pas10
-rw-r--r--plugins/ShlExt/shlipc.pas42
5 files changed, 124 insertions, 158 deletions
diff --git a/plugins/ShlExt/shlc.inc b/plugins/ShlExt/shlc.inc
index e1b76607f4..2952de8c74 100644
--- a/plugins/ShlExt/shlc.inc
+++ b/plugins/ShlExt/shlc.inc
@@ -57,7 +57,7 @@ type
PGUID = ^TGUID;
TGUID = record
- D1: Longint;
+ D1: Longword;
D2: Word;
D3: Word;
D4: array [0 .. 7] of Byte;
@@ -69,20 +69,13 @@ type
TStgMedium = record
tymed: Longint;
case Integer of
- 0:
- (hBitmap: hBitmap; unkForRelease: Pointer { IUnknown } );
- 1:
- (hMetaFilePict: THandle);
- 2:
- (hEnhMetaFile: THandle);
- 3:
- (hGlobal: hGlobal);
- 4:
- (lpszFileName: Pointer { POleStr } );
- 5:
- (stm: Pointer { IUnknown } );
- 6:
- (stg: Pointer { IStorage } );
+ 0: (hBitmap: hBitmap; unkForRelease: Pointer { IUnknown } );
+ 1: (hMetaFilePict: THandle);
+ 2: (hEnhMetaFile: THandle);
+ 3: (hGlobal: hGlobal);
+ 4: (lpszFileName: Pointer { POleStr } );
+ 5: (stm: Pointer { IUnknown } );
+ 6: (stg: Pointer { IStorage } );
end;
PFormatEtc = ^TFormatEtc;
diff --git a/plugins/ShlExt/shlcom.pas b/plugins/ShlExt/shlcom.pas
index d693dcb300..d3377d9cda 100644
--- a/plugins/ShlExt/shlcom.pas
+++ b/plugins/ShlExt/shlcom.pas
@@ -33,13 +33,12 @@ function ExtractIcon(hInst: THandle; pszExe: PChar; nIndex: Integer): HICON; std
implementation
var
+ dllpublic: record
+ FactoryCount: Integer;
+ ObjectCount: Integer;
+ end;
- dllpublic: record FactoryCount: Integer;
- ObjectCount: Integer;
-end;
-
-VistaOrLater:
-Boolean;
+ VistaOrLater:Boolean;
{$DEFINE COMAPI}
{$INCLUDE shlc.inc}
@@ -99,7 +98,10 @@ type
{ completely stolen from modules.c: 'NameHashFunction' modified slightly }
-function StrHash(const szStr: PChar): DWORD; cdecl;
+function StrHash(const szStr: PChar): DWORD;// cdecl;
+begin
+ result:=mir_hash(szStr,strlen(szStr));
+{
asm
// esi content has to be preserved with basm
push esi
@@ -108,7 +110,7 @@ asm
mov esi,szStr
mov al,[esi]
xor cl,cl
-@@lph_top: // only 4 of 9 instructions in here don't use AL, so optimal pipe use is impossible
+@@lph_top: // only 4 of 9 instructions in here don't use AL, so optimal pipe use is impossible
xor edx,eax
inc esi
xor eax,eax
@@ -121,6 +123,7 @@ asm
jnz @@lph_top // 5 clock tick loop. not bad.
xor eax,edx
pop esi
+}
end;
function CreateProcessUID(const pid: Cardinal): string;
@@ -168,8 +171,7 @@ type
AddRef: function(Self: Pointer): Cardinal; stdcall;
Release: function(Self: Pointer): Cardinal; stdcall;
{ IDataObject }
- GetData: function(Self: Pointer; var formatetcIn: TFormatEtc; var medium: TStgMedium)
- : HResult; stdcall;
+ GetData: function(Self:Pointer; var formatetcIn:TFormatEtc; var medium:TStgMedium): HResult; stdcall;
GetDataHere: Pointer;
QueryGetData: Pointer;
GetCanonicalFormatEtc: Pointer;
@@ -329,12 +331,11 @@ begin
end;
end;
-procedure DecideMenuItemInfo(pct: PSlotIPC; pg: PGroupNode; var mii: TMenuItemInfo;
- lParam: PEnumData);
+procedure DecideMenuItemInfo(pct: PSlotIPC; pg: PGroupNode; var mii: TMenuItemInfo; lParam: PEnumData);
var
psd: PMenuDrawInfo;
hDllHeap: THandle;
- j, c: Cardinal;
+ c: Cardinal;
pp: ^TSlotProtoIconsArray;
begin
mii.wID := lParam^.idCmdFirst;
@@ -346,7 +347,7 @@ begin
begin
psd^.cch := pct^.cbStrSection - 1; // no null;
psd^.szText := HeapAlloc(hDllHeap, 0, pct^.cbStrSection);
- lstrcpya(psd^.szText, PChar(Integer(pct) + sizeof(TSlotIPC)));
+ lstrcpya(psd^.szText, PChar(uint_ptr(pct) + sizeof(TSlotIPC)));
psd^.hContact := pct^.hContact;
psd^.fTypes := [dtContact];
// find the protocol icon array to use and which status
@@ -377,7 +378,7 @@ begin
psd^.wID := mii.wID;
psd^.szProfile := nil;
// store
- mii.dwItemData := Integer(psd);
+ mii.dwItemData := uint_ptr(psd);
if ((lParam^.bOwnerDrawSupported) and (lParam^.bShouldOwnerDraw)) then
begin
@@ -390,7 +391,7 @@ begin
mii.fType := MFT_STRING;
if pct <> nil then
begin
- int_ptr(mii.dwTypeData) := int_ptr(pct) + sizeof(TSlotIPC);
+ uint_ptr(mii.dwTypeData) := uint_ptr(pct) + sizeof(TSlotIPC);
end
else
begin
@@ -447,7 +448,7 @@ begin
// this is faster than the old version since we only ever walk one or at most two levels of the tree
// per tokenised section, and it doesn't matter if two levels use the same group name (which is valid)
// as the tokens processed is equatable to depth of the tree
- str.szStr := PChar(Integer(pct) + sizeof(TSlotIPC) + pct^.cbStrSection + 1);
+ str.szStr := PChar(uint_ptr(pct) + sizeof(TSlotIPC) + uint_ptr(pct^.cbStrSection) + 1);
sz := StrTok(str);
// restore the root
pg := group;
@@ -570,14 +571,12 @@ var
hBaseMenu: hMenu;
hGroupMenu: hMenu;
pg: PSlotIPC;
- szProf: PChar;
mii: TMenuItemInfo;
j: TGroupNodeList;
p, q: PGroupNode;
Depth, Hash: Cardinal;
Token: PChar;
tk: TStrTokRec;
- szBuf: PChar;
hDllHeap: THandle;
psd: PMenuDrawInfo;
c: Cardinal;
@@ -599,7 +598,7 @@ begin
Depth := 0;
p := j.First; // start at root again
// get the group
- int_ptr(tk.szStr) := (int_ptr(pg) + sizeof(TSlotIPC));
+ uint_ptr(tk.szStr) := (uint_ptr(pg) + sizeof(TSlotIPC));
// find each word between \ and create sub groups if needed.
Token := StrTok(tk);
while Token <> nil do
@@ -687,7 +686,7 @@ begin
psd^.wID := mii.wID;
// this is needed because there is a clear list command per each process.
psd^.pid := lParam^.pid;
- mii.dwItemData := Integer(psd);
+ Pointer(mii.dwItemData) := psd;
InsertMenuitem(lParam^.Self^.hRecentMenu, $FFFFFFFF, True, mii);
// insert MRU submenu into group menu (with) ownerdraw support as needed
@@ -699,7 +698,7 @@ begin
psd^.szText := HeapAlloc(hDllHeap, 0, psd^.cch + 1);
lstrcpyn(psd^.szText, lParam^.ipch^.MRUMenuName, sizeof(lParam^.ipch^.MRUMenuName) - 1);
- mii.dwItemData := Integer(psd);
+ pointer(mii.dwItemData) := psd;
if (lParam^.bOwnerDrawSupported) and (lParam^.bShouldOwnerDraw) then
begin
mii.fType := MFT_OWNERDRAW;
@@ -746,7 +745,7 @@ begin
if ((pg <> nil) and (pg^.Status = STATUS_PROFILENAME)) then
begin
psd^.szProfile := HeapAlloc(hDllHeap, 0, pg^.cbStrSection);
- lstrcpya(psd^.szProfile, PChar(Integer(pg) + sizeof(TSlotIPC)));
+ lstrcpya(psd^.szProfile, PChar(uint_ptr(pg) + sizeof(TSlotIPC)));
end; // if
// owner draw menus need ID's
mii.wID := lParam^.idCmdFirst;
@@ -768,7 +767,7 @@ begin
break;
end; // if
end; // while
- mii.dwItemData := Integer(psd);
+ pointer(mii.dwItemData) := psd;
if ((lParam^.bOwnerDrawSupported) and (lParam^.bShouldOwnerDraw)) then
begin
mii.fType := MFT_OWNERDRAW;
@@ -800,7 +799,7 @@ begin
begin
if (pct^.cbSize <> sizeof(TSlotIPC)) or (pct^.fType <> REQUEST_NEWICONS) then
break;
- int_ptr(p) := int_ptr(pct) + sizeof(TSlotIPC);
+ uint_ptr(p) := uint_ptr(pct) + sizeof(TSlotIPC);
ReAllocMem(Self^.ProtoIcons, (Self^.ProtoIconsCount + 1) * sizeof(TSlotProtoIcons));
d := @Self^.ProtoIcons[Self^.ProtoIconsCount];
CopyMemory(d, p, sizeof(TSlotProtoIcons));
@@ -845,7 +844,6 @@ var
pid: Integer;
hMirandaWorkEvent: THandle;
replyBits: Integer;
- hScreenDC: THandle;
szBuf: array [0 .. MAX_PATH] of Char;
begin
Result := True;
@@ -904,8 +902,7 @@ begin
end; // if
end;
-function TShlComRec_QueryInterface(Self: PCommon_Interface; const IID: TIID; var Obj)
- : HResult; stdcall;
+function TShlComRec_QueryInterface(Self: PCommon_Interface; const IID: TIID; var Obj): HResult; stdcall;
begin
Pointer(Obj) := nil;
{ IShellExtInit is given when the TShlRec is created }
@@ -1143,8 +1140,7 @@ begin
Result := E_NOTIMPL;
end;
-function ipcGetFiles(pipch: PHeaderIPC; pDataObject: PDataObject_Interface;
- const hContact: THandle): Integer;
+function ipcGetFiles(pipch: PHeaderIPC; pDataObject: PDataObject_Interface; const hContact: THandle): Integer;
type
TDragQueryFile = function(hDrop: THandle; fileIndex: Integer; FileName: PChar;
cbSize: Integer): Integer; stdcall;
@@ -1193,8 +1189,7 @@ begin
// store the hContact
pct^.hContact := hContact;
// copy it to the buffer
- DragQueryFile(stgm.hGlobal, iFile, PChar(Integer(pct) + sizeof(TSlotIPC)),
- pct^.cbStrSection);
+ DragQueryFile(stgm.hGlobal, iFile, PChar(uint_ptr(pct) + sizeof(TSlotIPC)), pct^.cbStrSection);
// next file
inc(iFile);
end; // while
@@ -1228,7 +1223,7 @@ begin
if GetMenuItemInfo(Self^.hRootMenu, Self^.idCmdFirst + idxCmd, False, mii) then
begin
// get the pointer
- int_ptr(psd) := mii.dwItemData;
+ uint_ptr(psd) := mii.dwItemData;
// the ID stored in the item pointer and the ID for the menu must match
if (psd = nil) or (psd^.wID <> mii.wID) then
begin
@@ -1251,8 +1246,7 @@ begin
if hTransfer <> 0 then
begin
// map the ipc file again
- hMap := CreateFileMapping(INVALID_HANDLE_VALUE, nil, PAGE_READWRITE, 0, IPC_PACKET_SIZE,
- IPC_PACKET_NAME);
+ hMap := CreateFileMapping(INVALID_HANDLE_VALUE,nil,PAGE_READWRITE,0,IPC_PACKET_SIZE,IPC_PACKET_NAME);
if (hMap <> 0) and (GetLastError <> ERROR_ALREADY_EXISTS) then
begin
// map it to process
@@ -1308,7 +1302,7 @@ end;
function TShlComRec_InvokeCommand(Self: PContextMenu3_Interface;
var lpici: TCMInvokeCommandInfo): HResult; stdcall;
begin
- Result := RequestTransfer(Self^.ptrInstance, LOWORD(Integer(lpici.lpVerb)));
+ Result := RequestTransfer(Self^.ptrInstance, LOWORD(uint_ptr(lpici.lpVerb)));
end;
function TShlComRec_HandleMenuMsgs(Self: PContextMenu3_Interface; uMsg: UINT; wParam: wParam;
@@ -1334,7 +1328,7 @@ begin
begin
// either a main sub menu, a group menu or a contact
dwi := PDrawItemStruct(lParam);
- int_ptr(psd) := dwi^.itemData;
+ uint_ptr(psd) := dwi^.itemData;
// don't fill
SetBkMode(dwi^.HDC, TRANSPARENT);
// where to draw the icon?
@@ -1437,7 +1431,7 @@ begin
begin
// don't check if it's really a menu
msi := PMeasureItemStruct(lParam);
- int_ptr(psd) := msi^.itemData;
+ uint_ptr(psd) := msi^.itemData;
ncm.cbSize := sizeof(TNonClientMetrics);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @ncm, 0);
// create the font used in menus, this font should be cached somewhere really
@@ -1571,8 +1565,7 @@ type
RefCount: LongInt;
end;
-function TClassFactoryRec_QueryInterface(Self: PClassFactoryRec; const IID: TIID; var Obj)
- : HResult; stdcall;
+function TClassFactoryRec_QueryInterface(Self: PClassFactoryRec; const IID: TIID; var Obj): HResult; stdcall;
begin
Pointer(Obj) := nil;
Result := E_NOTIMPL;
@@ -1754,7 +1747,8 @@ var
p: Pointer;
hMainThread: THandle;
begin
- Thread_Push(0,0);
+ result:=0;
+ Thread_Push(0,nil);
hMainThread := THandle(pipch^.Param);
GetCurrentDirectory(sizeof(szBuf), szBuf);
args.count := 0;
@@ -1765,7 +1759,7 @@ begin
begin
if (pct^.cbSize <> sizeof(TSlotIPC)) then
break;
- args.szFile := PChar(Integer(pct) + sizeof(TSlotIPC));
+ args.szFile := PChar(uint_ptr(pct) + sizeof(TSlotIPC));
args.hContact := pct^.hContact;
args.cch := pct^.cbStrSection + 1;
bQuit := AddToList(args);
@@ -1781,7 +1775,7 @@ begin
if (not bQuit) then
begin
args.hEvent := CreateEvent(nil, True, False, nil);
- QueueUserAPC(@MainThreadIssueTransfer, hMainThread, DWORD(@args));
+ QueueUserAPC(@MainThreadIssueTransfer, hMainThread, uint_ptr(@args));
while True do
begin
if WaitForSingleObjectEx(args.hEvent, INFINITE, True) <> WAIT_IO_COMPLETION then
@@ -1891,7 +1885,7 @@ begin
spi.hIcons[j] := LoadSkinnedProtoIcon(pp^.szName, ID_STATUS_OFFLINE + j);
end; // for
pct^.fType := REQUEST_NEWICONS;
- CopyMemory(Pointer(Integer(pct) + sizeof(TSlotIPC)), @spi, sizeof(TSlotProtoIcons));
+ CopyMemory(Pointer(uint_ptr(pct) + sizeof(TSlotIPC)), @spi, sizeof(TSlotProtoIcons));
if ipch^.NewIconsBegin = nil then
ipch^.NewIconsBegin := pct;
end; // if
@@ -1909,7 +1903,7 @@ begin
spi.hProto := 0; // no protocol
spi.hIcons[0] := LoadSkinnedIcon(SKINICON_OTHER_MIRANDA);
pct^.fType := REQUEST_NEWICONS;
- CopyMemory(Pointer(Integer(pct) + sizeof(TSlotIPC)), @spi, sizeof(TSlotProtoIcons));
+ CopyMemory(Pointer(uint_ptr(pct) + sizeof(TSlotIPC)), @spi, sizeof(TSlotProtoIcons));
if ipch^.NewIconsBegin = nil then
ipch^.NewIconsBegin := pct;
end; // if
@@ -1957,7 +1951,7 @@ begin
if i >= dwContacts then
break;
(* do they have a running protocol? *)
- int_ptr(szProto) := CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
+ uint_ptr(szProto) := CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0);
if szProto <> nil then
begin
(* does it support file sends? *)
@@ -2027,8 +2021,7 @@ begin
// create an IPC slot for each contact and store display name, etc
while i < dwContacts do
begin
- int_ptr(szContact) := CallService(MS_CLIST_GETCONTACTDISPLAYNAME,
- pContacts^[i].hContact, 0);
+ uint_ptr(szContact) := CallService(MS_CLIST_GETCONTACTDISPLAYNAME,pContacts^[i].hContact, 0);
if (szContact <> nil) then
begin
n := 0;
@@ -2050,7 +2043,7 @@ begin
end;
// lie about the actual size of the TSlotIPC
pct^.cbStrSection := cch;
- szSlot := PChar(Integer(pct) + sizeof(TSlotIPC));
+ szSlot := PChar(uint_ptr(pct) + sizeof(TSlotIPC));
lstrcpya(szSlot, szContact);
pct^.fType := REQUEST_CONTACTS;
pct^.hContact := pContacts^[i].hContact;
@@ -2090,7 +2083,8 @@ function ClearMRUThread(notused: Pointer): Cardinal; stdcall;
var
hContact: THandle;
begin
- Thread_Push(0,0);
+ result:=0;
+ Thread_Push(0,nil);
begin
hContact := CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
@@ -2116,16 +2110,11 @@ var
pMMT: PHeaderIPC;
hSignal: THandle;
pct: PSlotIPC;
- hContact: THandle;
- szContact: PChar;
- Status: int;
szBuf: PChar;
iSlot: Integer;
szGroupStr: array [0 .. 31] of Char;
dbv: TDBVariant;
bits: pint;
- HICON: THandle;
- i: Integer;
bGroupMode: Boolean;
tid: Cardinal;
cloned: PHeaderIPC;
@@ -2210,7 +2199,7 @@ begin
begin
// will actually return with .dat if there's space for it, not what the docs say
pct^.Status := STATUS_PROFILENAME;
- CallService(MS_DB_GETPROFILENAME, 49, Integer(pct) + sizeof(TSlotIPC));
+ CallService(MS_DB_GETPROFILENAME, 49, uint_ptr(pct) + sizeof(TSlotIPC));
end; // if
end; // if
if (bits^ and REQUEST_NEWICONS) = REQUEST_NEWICONS then
@@ -2233,7 +2222,7 @@ begin
pMMT^.GroupsBegin := pct;
pct^.fType := REQUEST_GROUPS;
pct^.hContact := 0;
- int_ptr(szBuf) := int_ptr(pct) + sizeof(TSlotIPC); // get the end of the slot
+ uint_ptr(szBuf) := uint_ptr(pct) + sizeof(TSlotIPC); // get the end of the slot
lstrcpya(szBuf, dbv.szVal.a + 1);
pct^.hGroup := 0;
DBFreeVariant(@dbv); // free the string
@@ -2287,7 +2276,8 @@ stdcall;
var
hEvent: THandle;
begin
- Thread_Push(0,0);
+ result:=0;
+ Thread_Push(0,nil);
hEvent := CreateEvent(nil, False, False, PChar(CreateProcessUID(GetCurrentProcessId())));
while True do
begin
diff --git a/plugins/ShlExt/shlext.dpr b/plugins/ShlExt/shlext.dpr
index 2c8c3f0c2d..792ed74f90 100644
--- a/plugins/ShlExt/shlext.dpr
+++ b/plugins/ShlExt/shlext.dpr
@@ -12,7 +12,6 @@
library shlext;
uses
-
Windows, shlcom, shlipc, m_api;
// use the registry to store the COM information needed by the shell
@@ -28,13 +27,11 @@ begin
{$ELSE}
// progID
szData := 'shlext (1.0.6.6) - shell context menu support for Miranda v0.3.0.0+';
- if ERROR_SUCCESS = RegSetValue(HKEY_CLASSES_ROOT, 'miranda.shlext', REG_SZ, szData,
- Length(szData)) then
+ if ERROR_SUCCESS = RegSetValue(HKEY_CLASSES_ROOT, 'miranda.shlext', REG_SZ, szData, Length(szData)) then
begin
// CLSID related to ProgID
szData := '{72013A26-A94C-11d6-8540-A5E62932711D}';
- if ERROR_SUCCESS = RegSetValue(HKEY_CLASSES_ROOT, 'miranda.shlext\CLSID', REG_SZ, szData,
- Length(szData)) then
+ if ERROR_SUCCESS = RegSetValue(HKEY_CLASSES_ROOT, 'miranda.shlext\CLSID', REG_SZ, szData, Length(szData)) then
begin
// CLSID link back to progID
szData := 'miranda.shlext';
@@ -44,14 +41,12 @@ begin
// CLSID link back to ProgID under \ProgID again?
szData := 'miranda.shlext';
if ERROR_SUCCESS = RegSetValue(HKEY_CLASSES_ROOT,
- 'CLSID\{72013A26-A94C-11d6-8540-A5E62932711D}\ProgID', REG_SZ, szData, Length(szData))
- then
+ 'CLSID\{72013A26-A94C-11d6-8540-A5E62932711D}\ProgID', REG_SZ, szData, Length(szData)) then
begin
GetMem(szData, MAX_PATH);
GetModuleFileName(hInstance, szData, MAX_PATH - 1);
Result := RegSetValue(HKEY_CLASSES_ROOT,
- 'CLSID\{72013A26-A94C-11d6-8540-A5E62932711D}\InprocServer32', REG_SZ, szData,
- Length(szData));
+ 'CLSID\{72013A26-A94C-11d6-8540-A5E62932711D}\InprocServer32', REG_SZ, szData, Length(szData));
FreeMem(szData);
if Result = ERROR_SUCCESS then
begin
@@ -62,15 +57,13 @@ begin
if Result = ERROR_SUCCESS then
begin
szData := 'Apartment';
- RegSetValueEx(hRegKey, 'ThreadingModel', 0, REG_SZ, PByte(szData),
- Length(szData) + 1);
+ RegSetValueEx(hRegKey, 'ThreadingModel', 0, REG_SZ, PByte(szData), Length(szData) + 1);
RegCloseKey(hRegKey);
// write which file types to show under
szData := '{72013A26-A94C-11d6-8540-A5E62932711D}';
// note that *\ should use AllFilesystemObjects for 4.71+
if ERROR_SUCCESS = RegSetValue(HKEY_CLASSES_ROOT,
- '*\shellex\ContextMenuHandlers\miranda.shlext', REG_SZ, szData, Length(szData))
- then
+ '*\shellex\ContextMenuHandlers\miranda.shlext', REG_SZ, szData, Length(szData)) then
begin
// don't support directories
if ERROR_SUCCESS = RegSetValue(HKEY_CLASSES_ROOT,
@@ -176,8 +169,7 @@ begin
SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, tS.cx + 10, tS.cy, SWP_NOMOVE or SWP_FRAMECHANGED);
end;
-function OptDialogProc(hwndDlg: THandle; wMsg: Integer; wParam: wParam; lParam: lParam)
- : BOOL; stdcall;
+function OptDialogProc(hwndDlg: THandle; wMsg: Integer; wParam: wParam; lParam: lParam): BOOL; stdcall;
// don't wanna bring in CommCtrl just for a few constants
const
{$IFNDEF FPC}
@@ -254,18 +246,18 @@ begin
iCheck := DBGetContactSettingByte(0, SHLExt_Name, SHLExt_UseGroups, BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_USEGROUPS, iCheck);
EnableWindow(GetDlgItem(hwndDlg, IDC_CLISTGROUPS), iCheck = BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_CLISTGROUPS, DBGetContactSettingByte(0, SHLExt_Name,
- SHLExt_UseCListSetting, BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_NOPROF, DBGetContactSettingByte(0, SHLExt_Name,
- SHLExt_ShowNoProfile, BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_SHOWFULL, DBGetContactSettingByte(0, SHLExt_Name,
- SHLExt_UseHITContacts, BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_SHOWINVISIBLES, DBGetContactSettingByte(0, SHLExt_Name,
- SHLExt_UseHIT2Contacts, BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_USEOWNERDRAW, DBGetContactSettingByte(0, SHLExt_Name,
- SHLExt_ShowNoIcons, BST_UNCHECKED));
- CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, DBGetContactSettingByte(0, SHLExt_Name,
- SHLExt_ShowNoOffline, BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_CLISTGROUPS,
+ DBGetContactSettingByte(0, SHLExt_Name, SHLExt_UseCListSetting, BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_NOPROF,
+ DBGetContactSettingByte(0, SHLExt_Name, SHLExt_ShowNoProfile, BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_SHOWFULL,
+ DBGetContactSettingByte(0, SHLExt_Name, SHLExt_UseHITContacts, BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_SHOWINVISIBLES,
+ DBGetContactSettingByte(0, SHLExt_Name, SHLExt_UseHIT2Contacts, BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_USEOWNERDRAW,
+ DBGetContactSettingByte(0, SHLExt_Name, SHLExt_ShowNoIcons, BST_UNCHECKED));
+ CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE,
+ DBGetContactSettingByte(0, SHLExt_Name, SHLExt_ShowNoOffline, BST_UNCHECKED));
// give the Remove button a Vista icon
SendMessage(GetDlgItem(hwndDlg, IDC_REMOVE), BCM_SETSHIELD, 0, 1);
end;
@@ -284,33 +276,33 @@ begin
end; // if
IDC_REMOVE:
begin
- if IDYES = MessageBox(0,
- Translate(
+ if IDYES = MessageBoxW(0,
+ TranslateW(
'Are you sure? this will remove all the settings stored in your database and all registry entries created for shlext to work with Explorer'),
- Translate('Disable/Remove shlext'), MB_YESNO or MB_ICONQUESTION) then
+ TranslateW('Disable/Remove shlext'), MB_YESNO or MB_ICONQUESTION) then
begin
cgs.szModule := SHLExt_Name;
cgs.szSetting := SHLExt_UseGroups;
- CallService(MS_DB_CONTACT_DELETESETTING, 0, Integer(@cgs));
+ CallService(MS_DB_CONTACT_DELETESETTING, 0, TLPARAM(@cgs));
cgs.szSetting := SHLExt_UseCListSetting;
- CallService(MS_DB_CONTACT_DELETESETTING, 0, Integer(@cgs));
+ CallService(MS_DB_CONTACT_DELETESETTING, 0, TLPARAM(@cgs));
cgs.szSetting := SHLExt_UseHITContacts;
- CallService(MS_DB_CONTACT_DELETESETTING, 0, Integer(@cgs));
+ CallService(MS_DB_CONTACT_DELETESETTING, 0, TLPARAM(@cgs));
cgs.szSetting := SHLExt_UseHIT2Contacts;
- CallService(MS_DB_CONTACT_DELETESETTING, 0, Integer(@cgs));
+ CallService(MS_DB_CONTACT_DELETESETTING, 0, TLPARAM(@cgs));
cgs.szSetting := SHLExt_ShowNoProfile;
- CallService(MS_DB_CONTACT_DELETESETTING, 0, Integer(@cgs));
+ CallService(MS_DB_CONTACT_DELETESETTING, 0, TLPARAM(@cgs));
cgs.szSetting := SHLExt_ShowNoIcons;
- CallService(MS_DB_CONTACT_DELETESETTING, 0, Integer(@cgs));
+ CallService(MS_DB_CONTACT_DELETESETTING, 0, TLPARAM(@cgs));
cgs.szSetting := SHLExt_ShowNoOffline;
- CallService(MS_DB_CONTACT_DELETESETTING, 0, Integer(@cgs));
+ CallService(MS_DB_CONTACT_DELETESETTING, 0, TLPARAM(@cgs));
(* remove from Explorer *)
// DllUnregisterServer();
@@ -346,39 +338,34 @@ begin
optDialog.hInstance := System.hInstance;
{$ENDIF}
optDialog.pfnDlgProc := @OptDialogProc;
- CallService(MS_OPT_ADDPAGE, wParam, Integer(@optDialog));
-end;
-var
- PLUGININFOEX: TPLUGININFOEX;
+ Options_AddPage(wParam,@optDialog);
+end;
function MirandaPluginInfoEx(mirandaVersion: DWORD): PPLUGININFOEX; cdecl;
begin
Result := nil;
- { only support v0.3.0.0+ }
- if PLUGIN_MAKE_VERSION(0, 3, 0, 0) > mirandaVersion then
- Exit;
{ fill in plugininfo }
- PLUGININFOEX.cbSize := sizeof(PLUGININFOEX);
- PLUGININFOEX.shortName := 'Shell context menus for transfers';
- PLUGININFOEX.version := PLUGIN_MAKE_VERSION(2, 0, 1, 2);
+ PluginInfo.cbSize := sizeof(PluginInfo);
+ PluginInfo.shortName := 'Shell context menus for transfers';
+ PluginInfo.version := PLUGIN_MAKE_VERSION(2, 0, 1, 2);
{$IFDEF FPC}
- PLUGININFOEX.description :=
+ PluginInfo.description :=
'Click ''n'' send support from Explorer/Common dialogs/Desktop, Right click on a file/folder to be presented with all your Miranda contact lists and then select the profile/contact you want to send to. Built on ' +
{$I %DATE%} +' at ' + {$I %TIME%} +' with FPC ' + {$I %FPCVERSION%};
{$ELSE}
- PLUGININFOEX.description := '';
+ PluginInfo.description := '';
{$ENDIF}
- PLUGININFOEX.author := 'egoDust';
- PLUGININFOEX.authorEmail := 'egodust@users.sourceforge.net';
- PLUGININFOEX.copyright := '(c) 2009 Sam Kothari (egoDust)';
- PLUGININFOEX.homePage := 'http://addons.miranda-im.org/details.php?action=viewfile&id=534';
- PLUGININFOEX.flags := 0;
- PLUGININFOEX.replacesDefaultModule := 0;
+ PluginInfo.author := 'egoDust';
+ PluginInfo.authorEmail := 'egodust@users.sourceforge.net';
+ PluginInfo.copyright := '(c) 2009 Sam Kothari (egoDust)';
+ PluginInfo.homePage := 'http://addons.miranda-im.org/details.php?action=viewfile&id=534';
+ PluginInfo.flags := 0;
+ PluginInfo.replacesDefaultModule := 0;
{ This UUID is fetched twice }
- CopyMemory(@PLUGININFOEX.uuid, @CLSID_ISHLCOM, sizeof(TMUUID));
+ CopyMemory(@PluginInfo.uuid, @CLSID_ISHLCOM, sizeof(TMUUID));
{ return info }
- Result := @PLUGININFOEX;
+ Result := @PluginInfo;
end;
function Load(): int; cdecl;
diff --git a/plugins/ShlExt/shlicons.pas b/plugins/ShlExt/shlicons.pas
index ec6a1f4922..195033ae8d 100644
--- a/plugins/ShlExt/shlicons.pas
+++ b/plugins/ShlExt/shlicons.pas
@@ -74,8 +74,7 @@ type
function ARGB_GetWorker: PImageFactory_Interface;
-function ARGB_BitmapFromIcon(Factory: PImageFactory_Interface; hdc: Windows.hdc; hIcon: hIcon)
- : HBitmap;
+function ARGB_BitmapFromIcon(Factory: PImageFactory_Interface; hdc: Windows.hdc; hIcon: hIcon): HBitmap;
implementation
@@ -111,8 +110,7 @@ begin
IID_WICImagingFactory, Result);
end;
-function ARGB_BitmapFromIcon(Factory: PImageFactory_Interface; hdc: Windows.hdc;
- hIcon: hIcon): HBitmap;
+function ARGB_BitmapFromIcon(Factory: PImageFactory_Interface; hdc: Windows.hdc; hIcon: hIcon): HBitmap;
var
bmi: BITMAPINFO;
hr: HResult;
@@ -132,7 +130,7 @@ begin
bmi.bmiHeader.biBitCount := 32;
- hr := Factory^.ptrVTable^.CreateBitmapFromHICON(Factory, hIcon, bitmap);
+ hr := Factory^.ptrVTable^.CreateBitmapFromHICON(Factory, hIcon, pointer(bitmap));
if hr = S_OK then
begin
hr := bitmap^.ptrVTable^.GetSize(bitmap, cx, cy);
@@ -142,7 +140,7 @@ begin
bmi.bmiHeader.biWidth := cx;
bmi.bmiHeader.biHeight := -cy;
- hBmp := CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, pbBuffer, 0, 0);
+ hBmp := CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, pointer(pbBuffer), 0, 0);
if hBmp <> 0 then
begin
cbStride := cx * sizeof(DWORD); // ARGB = DWORD
diff --git a/plugins/ShlExt/shlipc.pas b/plugins/ShlExt/shlipc.pas
index f2195f8060..17ab511e52 100644
--- a/plugins/ShlExt/shlipc.pas
+++ b/plugins/ShlExt/shlipc.pas
@@ -101,8 +101,7 @@ const
HIPC_NOICONS = 1;
procedure ipcPrepareRequests(ipcPacketSize: int; pipch: PHeaderIPC; fRequests: Cardinal);
-function ipcSendRequest(hSignal, hWaitFor: THandle; pipch: PHeaderIPC; dwTimeoutMsecs: DWORD)
- : Cardinal;
+function ipcSendRequest(hSignal, hWaitFor: THandle; pipch: PHeaderIPC; dwTimeoutMsecs: DWORD): Cardinal;
function ipcAlloc(pipch: PHeaderIPC; nSize: Integer): PSlotIPC;
procedure ipcFixupAddresses(FromServer: LongBool; pipch: PHeaderIPC);
@@ -141,7 +140,7 @@ type
end;
function AllocGroupNode(list: PGroupNodeList; Root: PGroupNode; Depth: Integer): PGroupNode;
-function FindGroupNode(P: PGroupNode; const Hash, Depth: Integer): PGroupNode;
+function FindGroupNode(P: PGroupNode; const Hash, Depth: dword): PGroupNode;
type
@@ -173,9 +172,7 @@ type
implementation
-{$INCLUDE m_helpers.inc}
-
-function FindGroupNode(P: PGroupNode; const Hash, Depth: Integer): PGroupNode;
+function FindGroupNode(P: PGroupNode; const Hash, Depth: dword): PGroupNode;
begin
Result := P;
while Result <> nil do
@@ -242,15 +239,14 @@ begin
// maybe used on the client side and are translated by the server side.
// ipcAlloc() is used on the client side when transferring filenames
// to the ST thread.
- int_ptr(pipch^.DataPtr) := int_ptr(pipch) + sizeof(THeaderIPC);
- int_ptr(pipch^.DataPtrEnd) := int_ptr(pipch^.DataPtr) + pipch^.DataSize;
+ uint_ptr(pipch^.DataPtr) := uint_ptr(pipch) + sizeof(THeaderIPC);
+ uint_ptr(pipch^.DataPtrEnd) := uint_ptr(pipch^.DataPtr) + pipch^.DataSize;
pipch^.DataFramePtr := pipch^.DataPtr;
// fill the data area
FillChar(pipch^.DataPtr^, pipch^.DataSize, 0);
end;
-function ipcSendRequest(hSignal, hWaitFor: THandle; pipch: PHeaderIPC; dwTimeoutMsecs: DWORD)
- : Cardinal;
+function ipcSendRequest(hSignal, hWaitFor: THandle; pipch: PHeaderIPC; dwTimeoutMsecs: DWORD): Cardinal;
begin
{ signal ST to work }
SetEvent(hSignal);
@@ -277,13 +273,13 @@ end;
function ipcAlloc(pipch: PHeaderIPC; nSize: Integer): PSlotIPC;
var
- PSP: int;
+ PSP: uint_ptr;
begin
Result := nil;
{ nSize maybe zero, in that case there is no string section --- }
- PSP := int(pipch^.DataFramePtr) + sizeof(TSlotIPC) + nSize;
+ PSP := uint_ptr(pipch^.DataFramePtr) + sizeof(TSlotIPC) + nSize;
{ is it past the end? }
- If PSP >= int(pipch^.DataPtrEnd) then
+ If PSP >= uint_ptr(pipch^.DataPtrEnd) then
Exit;
{ return the pointer }
Result := pipch^.DataFramePtr;
@@ -310,25 +306,27 @@ begin
// fix up all the pointers in the header
if pipch^.IconsBegin <> nil then
begin
- int_ptr(pipch^.IconsBegin) := (int_ptr(pipch^.IconsBegin) - iServerBase) + iClientBase;
+ uint_ptr(pipch^.IconsBegin) := (uint_ptr(pipch^.IconsBegin) - iServerBase) + iClientBase;
end; // if
+
if pipch^.ContactsBegin <> nil then
begin
- int_ptr(pipch^.ContactsBegin) := (int_ptr(pipch^.ContactsBegin) - iServerBase) +
- iClientBase;
+ uint_ptr(pipch^.ContactsBegin) := (uint_ptr(pipch^.ContactsBegin) - iServerBase) + iClientBase;
end; // if
+
if pipch^.GroupsBegin <> nil then
begin
- int_ptr(pipch^.GroupsBegin) := (int_ptr(pipch^.GroupsBegin) - iServerBase) + iClientBase;
+ uint_ptr(pipch^.GroupsBegin) := (uint_ptr(pipch^.GroupsBegin) - iServerBase) + iClientBase;
end; // if
+
if pipch^.NewIconsBegin <> nil then
begin
- int_ptr(pipch^.NewIconsBegin) := (int_ptr(pipch^.NewIconsBegin) - iServerBase) +
+ uint_ptr(pipch^.NewIconsBegin) := (uint_ptr(pipch^.NewIconsBegin) - iServerBase) +
iClientBase;
end;
- int_ptr(pipch^.DataPtr) := (int_ptr(pipch^.DataPtr) - iServerBase) + iClientBase;
- int_ptr(pipch^.DataPtrEnd) := (int_ptr(pipch^.DataPtrEnd) - iServerBase) + iClientBase;
- int_ptr(pipch^.DataFramePtr) := (int_ptr(pipch^.DataFramePtr) - iServerBase) + iClientBase;
+ uint_ptr(pipch^.DataPtr) := (uint_ptr(pipch^.DataPtr) - iServerBase) + iClientBase;
+ uint_ptr(pipch^.DataPtrEnd) := (uint_ptr(pipch^.DataPtrEnd) - iServerBase) + iClientBase;
+ uint_ptr(pipch^.DataFramePtr) := (uint_ptr(pipch^.DataFramePtr) - iServerBase) + iClientBase;
// and the link list
pct := pipch^.DataPtr;
while (pct <> nil) do
@@ -338,7 +336,7 @@ begin
q := @pct^.Next;
if q^ <> nil then
begin
- int_ptr(q^) := (int_ptr(q^) - iServerBase) + iClientBase;
+ uint_ptr(q^) := (uint_ptr(q^) - iServerBase) + iClientBase;
end; // if
pct := q^;
end; // while