本文整理汇总了C++中EXDLL_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ EXDLL_INIT函数的具体用法?C++ EXDLL_INIT怎么用?C++ EXDLL_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EXDLL_INIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __declspec
void __declspec(dllexport) SetTransparent(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
WINUSERAPI
BOOL WINAPI SetLayeredWindowAttributes(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
HWND hwnd;
BYTE bAlpha;
LONG lwnd;
EXDLL_INIT();
// MessageBox(hwndParent,"EXDLL_INIT",NULL,MB_OK);
extra->RegisterPluginCallback(g_hInstance, PluginCallback);
hwnd = (HWND) (popint());
bAlpha = popint() * 255 / 100;
if (IsWindow(hwnd))
{
lwnd = GetWindowLong(hwnd, GWL_EXSTYLE);
/* if (lwnd < WS_EX_LAYERED)
{
lwnd = lwnd + WS_EX_LAYERED;
SetWindowLong(hwnd, GWL_EXSTYLE, lwnd);
}*/
SetWindowLong(hwnd, GWL_EXSTYLE, lwnd | WS_EX_LAYERED);
SetLayeredWindowAttributes(hwnd, 0, bAlpha, LWA_ALPHA);
}
}
示例2: __declspec
extern "C" void __declspec(dllexport) IsUserAdmin( HWND hwndParent,
int string_size,
char *variables,
stack_t **stacktop)
{
EXDLL_INIT();
BOOL b = false;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup);
if(b)
{
if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
setuservariable( INST_0, "0" );
}
else
{
setuservariable( INST_0, "1" );
}
FreeSid(AdministratorsGroup);
}
}
示例3: __declspec
extern "C" void __declspec(dllexport) open_file_dialog(
HWND hwndParent,
int string_size,
char *variables,
stack_t **stacktop)
{
EXDLL_INIT();
char szBuffer[1024]="";
popstring(szBuffer);
HWND hWndParent = (HWND)atoi(szBuffer);
CFileDialog dlg(TRUE, _T("lic"), NULL, OFN_FILEMUSTEXIST,
_T("CrashFix License Files (*.lic)\0*.lic\0All Files (*.*)\0*.*\0\0"), hWndParent);
INT_PTR nResult = dlg.DoModal(hWndParent);
if(nResult==IDOK)
{
CStringA sFileName = dlg.m_szFileName;
pushstring(sFileName.GetBuffer());
}
else
{
pushstring("");
}
}
示例4: __declspec
void __declspec(dllexport) UpdateDriver(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop,
extra_parameters *extra)
{
int retval;
g_hwndParent=hwndParent;
EXDLL_INIT();
{
BOOL restart = 0;
DWORD flags = 0;//INSTALLFLAG_NONINTERACTIVE
DWORD lastErrorCode;
char hardwareID[256];
char infFilePath[256];
popstring(hardwareID);
popstring(infFilePath);
retval = eIDUpdateDriver(hwndParent,hardwareID,infFilePath,flags,&restart, &lastErrorCode);
if(retval != 0)
{
//on succes, let the caller know if a system reboot was requested
pushint((int)restart);
}
else
{
//on failure, send the error code
pushint((int)lastErrorCode);
}
pushint(retval);
}
}
示例5: VBoxTrayShowBallonMsg
/**
* Shows a balloon message using VBoxTray's notification area in the
* Windows task bar.
*
* @param hwndParent Window handle of parent.
* @param string_size Size of variable string.
* @param variables The actual variable string.
* @param stacktop Pointer to a pointer to the current stack.
*/
VBOXINSTALLHELPER_EXPORT VBoxTrayShowBallonMsg(HWND hwndParent, int string_size,
TCHAR *variables, stack_t **stacktop)
{
EXDLL_INIT();
VBOXTRAYIPCHEADER hdr;
hdr.ulMsg = VBOXTRAYIPCMSGTYPE_SHOWBALLOONMSG;
hdr.cbBody = sizeof(VBOXTRAYIPCMSG_SHOWBALLOONMSG);
VBOXTRAYIPCMSG_SHOWBALLOONMSG msg;
HRESULT hr = vboxPopString(msg.szContent, sizeof(msg.szContent) / sizeof(TCHAR));
if (SUCCEEDED(hr))
hr = vboxPopString(msg.szTitle, sizeof(msg.szTitle) / sizeof(TCHAR));
if (SUCCEEDED(hr))
hr = vboxPopULong(&msg.ulType);
if (SUCCEEDED(hr))
hr = vboxPopULong(&msg.ulShowMS);
if (SUCCEEDED(hr))
{
msg.ulFlags = 0;
HANDLE hPipe = vboxIPCConnect();
if (hPipe)
{
hr = vboxIPCWriteMessage(hPipe, (BYTE*)&hdr, sizeof(VBOXTRAYIPCHEADER));
if (SUCCEEDED(hr))
hr = vboxIPCWriteMessage(hPipe, (BYTE*)&msg, sizeof(VBOXTRAYIPCMSG_SHOWBALLOONMSG));
vboxIPCDisconnect(hPipe);
}
}
/* Push simple return value on stack. */
SUCCEEDED(hr) ? pushstring("0") : pushstring("1");
}
示例6: __declspec
void __declspec(dllexport) ExecToStack(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) {
g_hwndParent=hwndParent;
EXDLL_INIT();
{
ExecScript(2);
}
}
示例7: __declspec
void __declspec(dllexport) GetFileCRC32(HWND hwndParent, int string_size,
TCHAR *variables, stack_t **stacktop) {
g_hwndParent=hwndParent;
EXDLL_INIT();
{
TCHAR filename[MAX_PATH];
char crc_string[9];
HANDLE hFile;
unsigned long crc;
popstring(filename);
hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (hFile == INVALID_HANDLE_VALUE) {
//pushstring("ERROR: Unable to open file for CRC32 calculation");
pushstring(_T(""));
return;
}
if (!FileCRC(hFile, &crc)) {
//pushstring("ERROR: Unable to calculate CRC32");
pushstring(_T(""));
} else {
crc_string[8] = '\0';
CRC32ToString(crc_string,crc);
PushStringA(crc_string);
}
CloseHandle(hFile);
}
}
示例8: __declspec
void __declspec(dllexport) IsDotNet30Installed(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra) {
EXDLL_INIT();
// The .NET Framework 3.0 is an add-in that installs
// on top of the .NET Framework 2.0. For this version
// check, validate that both 2.0 and 3.0 are installed.
pushstring((IsNetfx20Installed() && IsNetfx30Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx20VersionString)) ? "true" : "false");
}
示例9: __declspec
void __declspec(dllexport) LangDialog(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop)
{
g_hwndParent=hwndParent;
EXDLL_INIT();
{
int i;
BOOL bPopOneMore = FALSE;
if (popstring(g_wndtitle)) return;
if (popstring(g_wndtext)) return;
if (popstring(temp)) return;
if (*temp == 'A')
{
stack_t *th;
langs_num=0;
th=(*g_stacktop);
while (th && th->text[0]) {
langs_num++;
th = th->next;
}
if (!th) return;
langs_num /= 2;
bPopOneMore = TRUE;
}
else
langs_num = myatoi(temp);
{
char *p=temp;
while (*p) if (*p++ == 'F') dofont=1;
}
if (!langs_num) return;
langs = (struct lang *)GlobalAlloc(GPTR, langs_num*sizeof(struct lang));
for (i = 0; i < langs_num; i++) {
if (popstring(temp)) return;
langs[i].name = GlobalAlloc(GPTR, lstrlen(temp)+1);
lstrcpy(langs[i].name, temp);
if (popstring(temp)) return;
langs[i].id = GlobalAlloc(GPTR, lstrlen(temp)+1);
lstrcpy(langs[i].id, temp);
}
if (bPopOneMore) {
if (popstring(temp)) return;
}
DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG), 0, DialogProc);
}
}
示例10: __declspec
extern "C" void __declspec(dllexport) show(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop)
{
EXDLL_INIT();
if (!initCalled) {
pushstring("error");
return;
}
initCalled--;
showCfgDlg();
}
示例11: __declspec
void __declspec(dllexport) CalculateSha512Sum(HWND hwndParent, int string_size,
TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
{
int i;
TCHAR filename[1024];
Sha512Context context;
HANDLE file;
char buffer[512];
char comp[1024];
DWORD bytesread;
SHA512_HASH sha512;
int compout;
EXDLL_INIT();
popstring(filename);
popstring(comp);
Sha512Initialise(&context);
file = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (!file)
{
filename[0] = '0';
filename[1] = 0;
pushstring(comp);
pushstring(filename);
return;
}
while (1)
{
ReadFile(file, buffer, 512, &bytesread, NULL);
if (!bytesread) break;
Sha512Update(&context, buffer, bytesread);
if (bytesread < 512) break;
}
Sha512Finalise(&context, &sha512);
CloseHandle(file);
for (i = 0; i < (512 / 8); i++)
{
buffer[i * 2] = hexdigit(sha512.bytes[i] >> 4);
buffer[(i * 2) + 1] = hexdigit(sha512.bytes[i] & 0xF);
}
buffer[512 / 4] = 0;
compout = memcmp(buffer, comp, 128);
if (compout)
{
filename[0] = '0';
}
else
{
filename[0] = '1';
}
filename[1] = 0;
pushstring(comp);
pushstring(filename);
}
示例12: FileGetVendor
/**
* Retrieves a file's vendor.
* Outputs the vendor's name or an error message (if not found/invalid) on stack.
*
* @param hwndParent Window handle of parent.
* @param string_size Size of variable string.
* @param variables The actual variable string.
* @param stacktop Pointer to a pointer to the current stack.
*/
VBOXINSTALLHELPER_EXPORT FileGetVendor(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
{
NOREF(hwndParent);
EXDLL_INIT();
TCHAR szFile[MAX_PATH + 1];
HRESULT hr = vboxPopString(szFile, sizeof(szFile) / sizeof(TCHAR));
if (SUCCEEDED(hr))
{
DWORD dwInfoSize = GetFileVersionInfoSize(szFile, NULL /* lpdwHandle */);
if (dwInfoSize)
{
void *pFileInfo = GlobalAlloc(GMEM_FIXED, dwInfoSize);
if (pFileInfo)
{
if (GetFileVersionInfo(szFile, 0, dwInfoSize, pFileInfo))
{
LPVOID pvInfo;
UINT puInfoLen;
if (VerQueryValue(pFileInfo, _T("\\VarFileInfo\\Translation"),
&pvInfo, &puInfoLen))
{
WORD wCodePage = LOWORD(*(DWORD*)pvInfo);
WORD wLanguageID = HIWORD(*(DWORD*)pvInfo);
TCHAR szQuery[MAX_PATH];
#pragma warning(suppress:4995) /* warning C4995: '_sntprintf': name was marked as #pragma deprecated */
_sntprintf(szQuery, sizeof(szQuery), _T("StringFileInfo\\%04X%04X\\CompanyName"),
wCodePage,wLanguageID);
LPCTSTR pcData;
if (VerQueryValue(pFileInfo, szQuery,(void**)&pcData, &puInfoLen))
{
pushstring(pcData);
}
else
hr = __HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
}
else
hr = __HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
}
GlobalFree(pFileInfo);
}
else
hr = __HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
}
else
hr = __HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
}
if (FAILED(hr))
vboxPushResultAsString(hr);
}
示例13: __declspec
void __declspec(dllexport) GetName(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop)
{
EXDLL_INIT();
{
DWORD dwStringSize = g_stringsize;
stack_t *th;
if (!g_stacktop) return;
th = (stack_t*) GlobalAlloc(GPTR, sizeof(stack_t) + g_stringsize);
GetUserName(th->text, &dwStringSize);
th->next = *g_stacktop;
*g_stacktop = th;
}
}
示例14: __declspec
void __declspec(dllexport) Create(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
{
HWND hwPlacementRect;
RECT rcPlacement;
EXDLL_INIT();
extra->RegisterPluginCallback(g_hInstance, PluginCallback);
g_dialog.hwParent = hwndParent;
g_pluginParms = extra;
hwPlacementRect = GetDlgItem(hwndParent, popint());
GetWindowRect(hwPlacementRect, &rcPlacement);
MapWindowPoints(NULL, hwndParent, (LPPOINT) &rcPlacement, 2);
g_dialog.hwDialog = CreateDialog(g_hInstance, MAKEINTRESOURCE(1), hwndParent, DialogProc);
if (g_dialog.hwDialog == NULL)
{
pushstring("error");
return;
}
SetWindowPos(
g_dialog.hwDialog,
0,
rcPlacement.left,
rcPlacement.top,
rcPlacement.right - rcPlacement.left,
rcPlacement.bottom - rcPlacement.top,
SWP_NOZORDER | SWP_NOACTIVATE
);
g_dialog.parentOriginalWndproc = (WNDPROC) SetWindowLong(hwndParent, DWL_DLGPROC, (long) ParentProc);
g_dialog.rtl = FALSE;
g_dialog.controlCount = 0;
g_dialog.controls = (struct nsControl*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 0);
g_dialog.callbacks.onBack = 0;
pushint((int) g_dialog.hwDialog);
}
示例15: DisableWFP
/**
* Disables the Windows File Protection for a specified file
* using an undocumented SFC API call. Don't try this at home!
*
* @param hwndParent Window handle of parent.
* @param string_size Size of variable string.
* @param variables The actual variable string.
* @param stacktop Pointer to a pointer to the current stack.
*/
VBOXINSTALLHELPER_EXPORT DisableWFP(HWND hwndParent, int string_size,
TCHAR *variables, stack_t **stacktop)
{
EXDLL_INIT();
TCHAR szFile[MAX_PATH + 1];
HRESULT hr = vboxPopString(szFile, sizeof(szFile) / sizeof(TCHAR));
if (SUCCEEDED(hr))
{
HMODULE hSFC = loadSystemDll("sfc_os.dll"); /** @todo Replace this by RTLdr APIs. */
if (NULL != hSFC)
{
g_pfnSfcFileException = (PFNSFCFILEEXCEPTION)GetProcAddress(hSFC, "SfcFileException");
if (g_pfnSfcFileException == NULL)
{
/* If we didn't get the proc address with the call above, try it harder with
* the (zero based) index of the function list. */
g_pfnSfcFileException = (PFNSFCFILEEXCEPTION)GetProcAddress(hSFC, (LPCSTR)5);
if (g_pfnSfcFileException == NULL)
hr = HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND);
}
}
else
hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
if (SUCCEEDED(hr))
{
WCHAR *pwszFile;
hr = vboxChar2WCharAlloc(szFile, &pwszFile);
if (SUCCEEDED(hr))
{
if (g_pfnSfcFileException(0, pwszFile, -1) != 0)
hr = HRESULT_FROM_WIN32(GetLastError());
vboxChar2WCharFree(pwszFile);
}
}
if (hSFC)
FreeLibrary(hSFC);
}
vboxPushResultAsString(hr);
}