Firebird API 포팅 중 사용할 수 없는 함수를 위해서 필요하다.
포팅을 해보라.
(본인의 저작물이 아님을 밝힌다.)
...., 시간나는 대로 테스트 중
참조 http://ourworld.compuserve.com/homepages/Guenter_Born/
Using the Dynacall.dll
RegSvr32.exe <path>dynacall.dll
(regsvr32dynwrap.dll/c )
After you have registered the dll, you can use an automation object to call your external functions.
' Create the wrapper object for dynamic DLL function callingDim UserWrap Set UserWrap = CreateObject("DynamicWrapper")' GetProcAddress for GetPrivateProfileStringA()UserWrap.Register "kernel32.DLL", "GetPrivateProfileString", "i=ssssls", "f=s", "r=l"The input parameters are:
i=describes the number and data type of the functions parameters
f=type of call _stdcall or _cdecl. So it can work with both MS C++ and Borland C++.
Default to _stdcall. If that doesn't work use _cdecl. If that doesn't work good luck!
r=return data type.
Data types are:
const ARGTYPEINFO ArgInfo[] = {{'a', sizeof(IDispatch*), VT_DISPATCH}, // a IDispatch*{'c', sizeof(unsigned char), VT_I4}, // c signed char {'d', sizeof(double), VT_R8}, // d 8 byte real {'f', sizeof(float), VT_R4}, // f 4 byte real {'k', sizeof(IUnknown*), VT_UNKNOWN}, // k IUnknown* {'h', sizeof(long), VT_I4}, // h HANDLE {'l', sizeof(long), VT_I4}, // l long {'p', sizeof(void*), VT_PTR}, // p pointer {'s', sizeof(BSTR), VT_LPSTR}, // s string {'t', sizeof(short), VT_I2}, // t short {'u', sizeof(UINT), VT_UINT}, // u unsigned int {'w', sizeof(BSTR), VT_LPWSTR}, // w wide string }William Epp added anr 'r' for VT_BYREF (pass by reference) but is for strings only.
This made the GETPROFILESTRING function to work. But it didn't work for the GETPROFILESECTION.
링크가 깨질것을 대비해서
DimUserWrap
DimhWnd,Ret
DimMyShell,MyWindow
ConstSW_SHOWMAXIMIZED=3
ConstWM_SYSCOMMAND=&H112
SetUserWrap=CreateObject("DynamicWrapper")
UserWrap.Register"USER32.DLL","SendMessage","i=hlll","f=s","r=l"
SetMyShell=WScript.CreateObject("Shell.Application")
ForEachMyWindowInMyShell.Windows
IfTypeName(MyWindow.document)="HTMLDocument"Then
hWnd=MyWindow.HWND
Ret=UserWrap_
.SendMessage(hWnd,WM_SYSCOMMAND,SW_SHOWMAXIMIZED,0)
EndIf
Next
SetUserWrap=Nothing
SetMyShell=Nothing
WScript.Quit
'*********************************************************************
DimUserWrap
DimhWnd,Ret
DimMyShell,MyWindow
ConstSW_SHOWMAXIMIZED=3
SetUserWrap=CreateObject("DynamicWrapper")
UserWrap.Register"USER32.DLL","ShowWindow","i=hl","f=s","r=l"
SetMyShell=WScript.CreateObject("Shell.Application")
ForEachMyWindowInMyShell.Windows
IfTypeName(MyWindow.document)="HTMLDocument"Then
hWnd=MyWindow.hWnd
Ret=UserWrap_
.ShowWindow(hWnd,SW_SHOWMAXIMIZED)
EndIf
Next
SetUserWrap=Nothing
SetMyShell=Nothing
WScript.Quit
'******************************************************************
1、C
(__cdecl)
int __cdecl Add(int a, int b)
{
return (a + b);
}
변鑒딧痰:
Add(1, 2);
push 2
push 1
call @Add ;페茄뻘唐긍陋포痰黨땍貫변鑒돨깊댐駕侶쟁겉劍伽쫠죄
addesp,8 ;헌攬
변鑒竟:
push ebp
mov ebp,esp
sub esp,40h ;변鑒賈痰돨攬칵훰槨40H(16*4),藤속寧몸긴좆속4bytesWIN32苟攬돨젓똑槨4bytes。
push ebx
push esi
push edi
leaedi,[ebp-40h] ;놓迦뺏痰黨맡변鑒돨攬왕쇌槨0XCCCCCCCC
mov ecx,10h
mov eax,0CCCCCCCCh
rep stos dword ptr [edi]
return (a + b);
mov eax,dword ptr [ebp+8]
add eax,dword ptr [ebp+0Ch]
pop edi
pop esi
pop ebx
mov esp,ebp ;흔벎瞳늪변鑒櫓뚤ESP쏵契꾸鱗,橙삔唐add esp, 40h cmp esp,ebp call chkesp,쇱꿴뎐놔돨ESP寧濾角뤠뵨EBP宮谿,흼꼇谿橙딧痰chkesp테놔嫩끽
pop ebp
ret
2、Pascal
(Windows API ,Pascal)
(__stdcall,__pascal)
앨절:
int __stdcall Add(int a, int b)
{
return (a + b);
}
변鑒돨딧痰:
push 2
push 1
call _Add@8 ;侶쟁賈痰죄젯쌈珂賈痰돨변鑒츰
변鑒竟:
;뵨__cdecl寧湳,離빈寧契흔苟:
ret 8 ;헌攬
;이하 생략
참조 http://www.codeproject.com/cpp/calling_conventions_demystified.asp
'Firebird Database' 카테고리의 다른 글
오픈소스 데이터베이스 Firebird 2.0 C 프로그래밍 (0) | 2006.12.01 |
---|---|
오픈소스 데이터베이스 Firebird 2.0의 속성 좀 보자 (0) | 2006.11.28 |
오픈소스 데이터베이스 Firebird 2.0 Basic 프로그래밍 (0) | 2006.11.26 |
오픈소스 데이터베이스 Firebird 2.0 ODBC 설정 (0) | 2006.11.26 |
오픈소스 데이터베이스 Firebird 2.0 (1) | 2006.11.26 |