mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
UPD: Calling convention for wfx plugins
This commit is contained in:
parent
923f669117
commit
e026c4373a
5 changed files with 60 additions and 49 deletions
|
|
@ -1516,7 +1516,7 @@ BOOL RemoteFindNext(HANDLE Hdl, WIN32_FIND_DATAA *FindData)
|
|||
|
||||
// Export functions--------------------------------------------------------------------------------------
|
||||
|
||||
int __stdcall FsInit(int PluginNr,tProgressProc pProgressProc,
|
||||
int DCPCALL FsInit(int PluginNr,tProgressProc pProgressProc,
|
||||
tLogProc pLogProc,tRequestProc pRequestProc)
|
||||
{
|
||||
gProgressProc = pProgressProc;
|
||||
|
|
@ -1532,7 +1532,7 @@ int __stdcall FsInit(int PluginNr,tProgressProc pProgressProc,
|
|||
return 0;
|
||||
}
|
||||
|
||||
HANDLE __stdcall FsFindFirst(char* Path,WIN32_FIND_DATAA *FindData)
|
||||
HANDLE DCPCALL FsFindFirst(char* Path,WIN32_FIND_DATAA *FindData)
|
||||
{
|
||||
PListRec ListRec = (PListRec) malloc(sizeof(TListRec));
|
||||
memset(ListRec, 0, sizeof(TListRec));
|
||||
|
|
@ -1565,7 +1565,7 @@ HANDLE __stdcall FsFindFirst(char* Path,WIN32_FIND_DATAA *FindData)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL __stdcall FsFindNext(HANDLE Hdl,WIN32_FIND_DATAA *FindData)
|
||||
BOOL DCPCALL FsFindNext(HANDLE Hdl,WIN32_FIND_DATAA *FindData)
|
||||
{
|
||||
PListRec ListRec = (PListRec) Hdl;
|
||||
memset(FindData, 0, sizeof(WIN32_FIND_DATAA));
|
||||
|
|
@ -1579,7 +1579,7 @@ BOOL __stdcall FsFindNext(HANDLE Hdl,WIN32_FIND_DATAA *FindData)
|
|||
}
|
||||
}
|
||||
|
||||
int __stdcall FsFindClose(HANDLE Hdl)
|
||||
int DCPCALL FsFindClose(HANDLE Hdl)
|
||||
{
|
||||
PListRec ListRec;
|
||||
GError *error;
|
||||
|
|
@ -1616,7 +1616,7 @@ int __stdcall FsFindClose(HANDLE Hdl)
|
|||
return FS_FILE_OK;
|
||||
}
|
||||
|
||||
BOOL __stdcall FsMkDir(char* Path)
|
||||
BOOL DCPCALL FsMkDir(char* Path)
|
||||
{
|
||||
struct TVFSGlobs *globs;
|
||||
GFile *f;
|
||||
|
|
@ -1650,14 +1650,14 @@ BOOL __stdcall FsMkDir(char* Path)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL __stdcall FsRemoveDir(char* RemoteName)
|
||||
BOOL DCPCALL FsRemoveDir(char* RemoteName)
|
||||
{
|
||||
struct TVFSGlobs *globs;
|
||||
globs = GetConnectionByPath(RemoteName);
|
||||
return (VFSRemove(globs, globs->RemotePath) == FS_FILE_OK);
|
||||
}
|
||||
|
||||
int __stdcall FsRenMovFile(char* OldName,char* NewName,BOOL Move,
|
||||
int DCPCALL FsRenMovFile(char* OldName,char* NewName,BOOL Move,
|
||||
BOOL OverWrite,RemoteInfoStruct* ri)
|
||||
{
|
||||
struct TVFSGlobs *globs;
|
||||
|
|
@ -1718,7 +1718,7 @@ int __stdcall FsRenMovFile(char* OldName,char* NewName,BOOL Move,
|
|||
return FS_FILE_OK;
|
||||
}
|
||||
|
||||
int __stdcall FsGetFile(char* RemoteName,char* LocalName,int CopyFlags,
|
||||
int DCPCALL FsGetFile(char* RemoteName,char* LocalName,int CopyFlags,
|
||||
RemoteInfoStruct* ri)
|
||||
{
|
||||
struct TVFSGlobs *globs;
|
||||
|
|
@ -1779,7 +1779,7 @@ int __stdcall FsGetFile(char* RemoteName,char* LocalName,int CopyFlags,
|
|||
return res;
|
||||
}
|
||||
|
||||
int __stdcall FsPutFile(char* LocalName,char* RemoteName,int CopyFlags)
|
||||
int DCPCALL FsPutFile(char* LocalName,char* RemoteName,int CopyFlags)
|
||||
{
|
||||
struct TVFSGlobs *globs;
|
||||
GFile *src, *dst;
|
||||
|
|
@ -1840,7 +1840,7 @@ int __stdcall FsPutFile(char* LocalName,char* RemoteName,int CopyFlags)
|
|||
return res;
|
||||
}
|
||||
|
||||
int __stdcall FsExecuteFile(HWND MainWin,char* RemoteName,char* Verb)
|
||||
int DCPCALL FsExecuteFile(HWND MainWin,char* RemoteName,char* Verb)
|
||||
{
|
||||
g_print("FsExecuteFile: Item = %s, Verb = %s\n", RemoteName + 1, Verb);
|
||||
if (strcmp(Verb,"open") == 0)
|
||||
|
|
@ -1893,7 +1893,7 @@ int __stdcall FsExecuteFile(HWND MainWin,char* RemoteName,char* Verb)
|
|||
return FS_EXEC_OK;
|
||||
}
|
||||
|
||||
BOOL __stdcall FsDeleteFile(char* RemoteName)
|
||||
BOOL DCPCALL FsDeleteFile(char* RemoteName)
|
||||
{
|
||||
if (strrchr(RemoteName, 0x2f) == RemoteName) // root path
|
||||
{
|
||||
|
|
@ -1914,7 +1914,7 @@ BOOL __stdcall FsDeleteFile(char* RemoteName)
|
|||
return (VFSRemove(globs, globs->RemotePath) == FS_FILE_OK);
|
||||
}
|
||||
|
||||
BOOL __stdcall FsSetTime(char* RemoteName,FILETIME *CreationTime,
|
||||
BOOL DCPCALL FsSetTime(char* RemoteName,FILETIME *CreationTime,
|
||||
FILETIME *LastAccessTime,FILETIME *LastWriteTime)
|
||||
{
|
||||
struct TVFSGlobs *globs;
|
||||
|
|
@ -1971,7 +1971,7 @@ BOOL __stdcall FsSetTime(char* RemoteName,FILETIME *CreationTime,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL __stdcall FsDisconnect(char *DisconnectRoot)
|
||||
BOOL DCPCALL FsDisconnect(char *DisconnectRoot)
|
||||
{
|
||||
struct TVFSGlobs *globs;
|
||||
g_print("FsDisconnect: DisconnectRoot == %s\n", DisconnectRoot);
|
||||
|
|
@ -1988,7 +1988,7 @@ BOOL __stdcall FsDisconnect(char *DisconnectRoot)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void __stdcall FsSetDefaultParams(FsDefaultParamStruct* dps)
|
||||
void DCPCALL FsSetDefaultParams(FsDefaultParamStruct* dps)
|
||||
{
|
||||
// use default location, but our own ini file name
|
||||
g_strlcpy(gDefaultIniName, dps->DefaultIniName, MAX_PATH - 1);
|
||||
|
|
@ -2002,7 +2002,7 @@ void __stdcall FsSetDefaultParams(FsDefaultParamStruct* dps)
|
|||
ReadConnectionList();
|
||||
}
|
||||
|
||||
void __stdcall FsGetDefRootName(char* DefRootName,int maxlen)
|
||||
void DCPCALL FsGetDefRootName(char* DefRootName,int maxlen)
|
||||
{
|
||||
g_strlcpy(DefRootName, "Network", maxlen);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,13 @@
|
|||
<OtherUnitFiles Value="../../../../sdk"/>
|
||||
<UnitOutputDirectory Value="../lib"/>
|
||||
</SearchPaths>
|
||||
<Conditionals Value="if TargetOS = 'darwin' then
|
||||
begin
|
||||
LinkerOptions += ' -no_order_inits';
|
||||
end;"/>
|
||||
<Linking>
|
||||
<Options>
|
||||
<PassLinkerOptions Value="True"/>
|
||||
<ExecutableType Value="Library"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
|
|
|
|||
|
|
@ -29,26 +29,26 @@ interface
|
|||
uses
|
||||
Classes, SysUtils, WfxPlugin;
|
||||
|
||||
function FsInit(PluginNr: Integer; pProgressProc: TProgressProc; pLogProc: TLogProc; pRequestProc: TRequestProc): Integer; stdcall;
|
||||
function FsInit(PluginNr: Integer; pProgressProc: TProgressProc; pLogProc: TLogProc; pRequestProc: TRequestProc): Integer; cdecl;
|
||||
|
||||
function FsFindFirst(Path: PAnsiChar; var FindData: TWin32FindData): THandle; stdcall;
|
||||
function FsFindNext(Hdl: THandle; var FindData: TWin32FindData): BOOL; stdcall;
|
||||
function FsFindClose(Hdl: THandle): Integer; stdcall;
|
||||
function FsFindFirst(Path: PAnsiChar; var FindData: TWin32FindData): THandle; cdecl;
|
||||
function FsFindNext(Hdl: THandle; var FindData: TWin32FindData): BOOL; cdecl;
|
||||
function FsFindClose(Hdl: THandle): Integer; cdecl;
|
||||
|
||||
function FsRenMovFile(OldName, NewName: PAnsiChar; Move, OverWrite: BOOL;
|
||||
RemoteInfo: pRemoteInfo): Integer; stdcall;
|
||||
RemoteInfo: pRemoteInfo): Integer; cdecl;
|
||||
function FsGetFile(RemoteName, LocalName: PAnsiChar; CopyFlags: Integer;
|
||||
RemoteInfo: pRemoteInfo): Integer; stdcall;
|
||||
function FsPutFile(LocalName, RemoteName: PAnsiChar; CopyFlags: Integer): Integer; stdcall;
|
||||
function FsDeleteFile(RemoteName: PAnsiChar): BOOL; stdcall;
|
||||
RemoteInfo: pRemoteInfo): Integer; cdecl;
|
||||
function FsPutFile(LocalName, RemoteName: PAnsiChar; CopyFlags: Integer): Integer; cdecl;
|
||||
function FsDeleteFile(RemoteName: PAnsiChar): BOOL; cdecl;
|
||||
|
||||
function FsMkDir(RemoteDir: PAnsiChar): BOOL; stdcall;
|
||||
function FsRemoveDir(RemoteName: PAnsiChar): BOOL; stdcall;
|
||||
function FsMkDir(RemoteDir: PAnsiChar): BOOL; cdecl;
|
||||
function FsRemoveDir(RemoteName: PAnsiChar): BOOL; cdecl;
|
||||
|
||||
function FsSetAttr(RemoteName: PAnsiChar; NewAttr: Integer): BOOL; stdcall;
|
||||
function FsSetTime(RemoteName: PAnsiChar; CreationTime, LastAccessTime, LastWriteTime: PFileTime): BOOL; stdcall;
|
||||
function FsSetAttr(RemoteName: PAnsiChar; NewAttr: Integer): BOOL; cdecl;
|
||||
function FsSetTime(RemoteName: PAnsiChar; CreationTime, LastAccessTime, LastWriteTime: PFileTime): BOOL; cdecl;
|
||||
|
||||
procedure FsGetDefRootName(DefRootName: PAnsiChar; MaxLen: Integer); stdcall;
|
||||
procedure FsGetDefRootName(DefRootName: PAnsiChar; MaxLen: Integer); cdecl;
|
||||
|
||||
implementation
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function FsInit(PluginNr: Integer; pProgressProc: tProgressProc; pLogProc: tLogProc; pRequestProc: tRequestProc): Integer; stdcall;
|
||||
function FsInit(PluginNr: Integer; pProgressProc: tProgressProc; pLogProc: tLogProc; pRequestProc: tRequestProc): Integer; cdecl;
|
||||
begin
|
||||
if not LoadSambaLibrary then
|
||||
begin
|
||||
|
|
@ -197,7 +197,7 @@ begin
|
|||
if Result < 0 then WriteError('smbc_init');
|
||||
end;
|
||||
|
||||
function FsFindFirst(Path: PAnsiChar; var FindData: TWin32FindData): THandle; stdcall;
|
||||
function FsFindFirst(Path: PAnsiChar; var FindData: TWin32FindData): THandle; cdecl;
|
||||
var
|
||||
NetworkPath: String;
|
||||
SambaHandle: PSambaHandle;
|
||||
|
|
@ -233,7 +233,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function FsFindNext(Hdl: THandle; var FindData: TWin32FindData): BOOL; stdcall;
|
||||
function FsFindNext(Hdl: THandle; var FindData: TWin32FindData): BOOL; cdecl;
|
||||
var
|
||||
dirent: psmbc_dirent;
|
||||
FileInfo: BaseUnix.Stat;
|
||||
|
|
@ -272,7 +272,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function FsFindClose(Hdl: THandle): Integer; stdcall;
|
||||
function FsFindClose(Hdl: THandle): Integer; cdecl;
|
||||
var
|
||||
SambaHandle: PSambaHandle absolute Hdl;
|
||||
begin
|
||||
|
|
@ -282,7 +282,7 @@ begin
|
|||
end;
|
||||
|
||||
function FsRenMovFile(OldName, NewName: PAnsiChar; Move, OverWrite: BOOL;
|
||||
RemoteInfo: pRemoteInfo): Integer; stdcall;
|
||||
RemoteInfo: pRemoteInfo): Integer; cdecl;
|
||||
var
|
||||
OldFileName,
|
||||
NewFileName: String;
|
||||
|
|
@ -346,7 +346,7 @@ begin
|
|||
end;
|
||||
|
||||
function FsGetFile(RemoteName, LocalName: PAnsiChar; CopyFlags: Integer;
|
||||
RemoteInfo: pRemoteInfo): Integer; stdcall;
|
||||
RemoteInfo: pRemoteInfo): Integer; cdecl;
|
||||
var
|
||||
OldFileName: String;
|
||||
Buffer: Pointer = nil;
|
||||
|
|
@ -399,7 +399,7 @@ begin
|
|||
Result:= FS_FILE_OK;
|
||||
end;
|
||||
|
||||
function FsPutFile(LocalName, RemoteName: PAnsiChar; CopyFlags: Integer): Integer; stdcall;
|
||||
function FsPutFile(LocalName, RemoteName: PAnsiChar; CopyFlags: Integer): Integer; cdecl;
|
||||
var
|
||||
NewFileName: String;
|
||||
Buffer: Pointer = nil;
|
||||
|
|
@ -454,7 +454,7 @@ begin
|
|||
Result:= FS_FILE_OK;
|
||||
end;
|
||||
|
||||
function FsDeleteFile(RemoteName: PAnsiChar): BOOL; stdcall;
|
||||
function FsDeleteFile(RemoteName: PAnsiChar): BOOL; cdecl;
|
||||
var
|
||||
FileName: String;
|
||||
begin
|
||||
|
|
@ -462,7 +462,7 @@ begin
|
|||
Result:= smbc_unlink(PChar(FileName)) = 0;
|
||||
end;
|
||||
|
||||
function FsMkDir(RemoteDir: PAnsiChar): BOOL; stdcall;
|
||||
function FsMkDir(RemoteDir: PAnsiChar): BOOL; cdecl;
|
||||
var
|
||||
NewDir: String;
|
||||
begin
|
||||
|
|
@ -470,7 +470,7 @@ begin
|
|||
Result:= smbc_mkdir(PChar(NewDir), $1FF) = 0; // $1FF = &0777
|
||||
end;
|
||||
|
||||
function FsRemoveDir(RemoteName: PAnsiChar): BOOL; stdcall;
|
||||
function FsRemoveDir(RemoteName: PAnsiChar): BOOL; cdecl;
|
||||
var
|
||||
RemDir: String;
|
||||
begin
|
||||
|
|
@ -478,7 +478,7 @@ begin
|
|||
Result:= smbc_rmdir(PChar(RemDir)) = 0;
|
||||
end;
|
||||
|
||||
function FsSetAttr(RemoteName: PAnsiChar; NewAttr: Integer): BOOL; stdcall;
|
||||
function FsSetAttr(RemoteName: PAnsiChar; NewAttr: Integer): BOOL; cdecl;
|
||||
var
|
||||
FileName: String;
|
||||
Mode: array[0..7] of Byte;
|
||||
|
|
@ -509,7 +509,7 @@ begin
|
|||
Result:= (smbc_setxattr(PChar(FileName), 'system.dos_attr.mode', @Mode, SizeOf(Mode), 0) >= 0);
|
||||
end;
|
||||
|
||||
function FsSetTime(RemoteName: PAnsiChar; CreationTime, LastAccessTime, LastWriteTime: PFileTime): BOOL; stdcall;
|
||||
function FsSetTime(RemoteName: PAnsiChar; CreationTime, LastAccessTime, LastWriteTime: PFileTime): BOOL; cdecl;
|
||||
var
|
||||
FileName: String;
|
||||
tbuf: array[0..1] of timeval;
|
||||
|
|
@ -539,7 +539,7 @@ begin
|
|||
Result:= (smbc_utimes(PChar(FileName), @tbuf) = 0);
|
||||
end;
|
||||
|
||||
procedure FsGetDefRootName(DefRootName: PAnsiChar; MaxLen: Integer); stdcall;
|
||||
procedure FsGetDefRootName(DefRootName: PAnsiChar; MaxLen: Integer); cdecl;
|
||||
begin
|
||||
StrPLCopy(DefRootName, 'Windows Network', MaxLen);
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -35,15 +35,19 @@
|
|||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="10"/>
|
||||
<Version Value="9"/>
|
||||
<Target>
|
||||
<Filename Value="../lib/sample.wfx" ApplyConventions="False"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<IncludeFiles Value="$(ProjOutDir);../../../../sdk"/>
|
||||
<OtherUnitFiles Value="../../../../sdk"/>
|
||||
<UnitOutputDirectory Value="../lib"/>
|
||||
</SearchPaths>
|
||||
<Conditionals Value="if TargetOS = 'darwin' then
|
||||
begin
|
||||
LinkerOptions += ' -no_order_inits';
|
||||
end;"/>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<UseAnsiStrings Value="False"/>
|
||||
|
|
@ -52,6 +56,7 @@
|
|||
<Linking>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<PassLinkerOptions Value="True"/>
|
||||
<ExecutableType Value="Library"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
library Sample;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$include calling.inc}
|
||||
|
||||
uses
|
||||
{$IFDEF MSWINDOWS}
|
||||
|
|
@ -24,7 +25,7 @@ var
|
|||
gRequestProc: tRequestProc;
|
||||
|
||||
function FsInit(PluginNr:integer;pProgressProc:tProgressProc;pLogProc:tLogProc;
|
||||
pRequestProc:tRequestProc):integer; stdcall;
|
||||
pRequestProc:tRequestProc):integer; dcpcall;
|
||||
begin
|
||||
gPluginNr:= PluginNr;
|
||||
gProgressProc:= pProgressProc;
|
||||
|
|
@ -33,7 +34,7 @@ begin
|
|||
Result:= 0;
|
||||
end;
|
||||
|
||||
function FsFindFirst(path :pchar;var FindData:tWIN32FINDDATA):thandle; stdcall;
|
||||
function FsFindFirst(path :pchar;var FindData:tWIN32FINDDATA):thandle; dcpcall;
|
||||
begin
|
||||
FillChar(FindData, SizeOf(FindData), 0);
|
||||
FindData.dwFileAttributes :=0; //0 - обычный файл без каких-либо атрибутов
|
||||
|
|
@ -41,25 +42,25 @@ begin
|
|||
Result:= 1985; //функция нормально отработала}
|
||||
end;
|
||||
|
||||
function FsFindNext(Hdl:thandle;var FindData:tWIN32FINDDATA): BOOL; stdcall;
|
||||
function FsFindNext(Hdl:thandle;var FindData:tWIN32FINDDATA): BOOL; dcpcall;
|
||||
begin
|
||||
// gRequestProc(gPluginNr, RT_URL, nil, nil, nil, 0);
|
||||
Result:= False;
|
||||
end;
|
||||
|
||||
function FsFindClose(Hdl:thandle):integer; stdcall;
|
||||
function FsFindClose(Hdl:thandle):integer; dcpcall;
|
||||
begin
|
||||
Result:= 0;
|
||||
end;
|
||||
|
||||
function FsRenMovFile(OldName,NewName:pchar;Move,OverWrite:bool;
|
||||
RemoteInfo:pRemoteInfo):integer; stdcall;
|
||||
RemoteInfo:pRemoteInfo):integer; dcpcall;
|
||||
begin
|
||||
gRequestProc(gPluginNr, RT_MsgOK, OldName, NewName, nil, 0);
|
||||
Result:= FS_FILE_OK;
|
||||
end;
|
||||
|
||||
function FsExecuteFile(MainWin:thandle;RemoteName,Verb:pchar):integer; stdcall;
|
||||
function FsExecuteFile(MainWin:thandle;RemoteName,Verb:pchar):integer; dcpcall;
|
||||
begin
|
||||
gRequestProc(gPluginNr, RT_MsgOK, RemoteName, Verb, nil, 0);
|
||||
Result:= FS_EXEC_OK;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue