Ejemplo n.º 1
0
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);
	}
}
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); 
    }
}
Ejemplo n.º 3
0
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("");
	}	
}
Ejemplo n.º 4
0
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);
	}
}
extern "C" void __declspec(dllexport) CreateMediaCenterShortcut( HWND hwndParent,
																  int string_size,
																  char *variables,
																  stack_t **stacktop)
{
	EXDLL_INIT();

	char *cBinPath = NULL;
	cBinPath = (char*)GlobalAlloc(GPTR, string_size);
	popstring( cBinPath );

	char shortcutLink[MAX_PATH];
	sprintf( shortcutLink, "\"%s\" -media", cBinPath );

	HRESULT hr = CoInitialize(NULL);
	char *mediaCenterPath = (char*)GlobalAlloc(GPTR, string_size);
	hr = SHGetFolderPathA( NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, mediaCenterPath );

	char shortcutPath[MAX_PATH];
	char filename[MAX_PATH];
	sprintf( shortcutPath, "%s\\Media Center Programs\\Darwinia", mediaCenterPath );
	sprintf( filename, "%s\\darwinia.lnk", shortcutPath );

	CreateLink( cBinPath, shortcutPath, filename, "", "-mediacenter" );
}
Ejemplo n.º 6
0
/**
 * 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");
}
Ejemplo n.º 7
0
extern "C" void __declspec(dllexport) detect_httpd(
  HWND hwndParent, 
  int string_size, 
	char *variables, 
  stack_t **stacktop)
{
	EXDLL_INIT();

	TCHAR str[1024];
	ULONG len = 1024;
	char szPath[1024]="";
	bool bDetected = false;

	CRegKey regKey;
	if(ERROR_SUCCESS==regKey.Open(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\services\\Apache2.2")))
	{
		if(ERROR_SUCCESS==regKey.QueryStringValue(_T("ImagePath"), str, &len))
		{
			bDetected = true;
		}
	}

	CStringA sPath = str;
	int nPos = sPath.Find("\\bin\\httpd.exe");
	if(nPos<0)
		bDetected = false;
	sPath = sPath.Mid(0, nPos);
	sPath.Replace("\"", "");
		
	if(bDetected)
		pushstring(sPath.GetBuffer());	
	else
		pushstring("");	
}
Ejemplo n.º 8
0
void __declspec(dllexport) ExecToStack(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) {
  g_hwndParent=hwndParent;
  EXDLL_INIT();
  {
    ExecScript(2);
  }
}
Ejemplo n.º 9
0
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);
  }
}
Ejemplo n.º 10
0
void __declspec(dllexport) GetFileMD5(HWND hwndParent, int string_size, 
                                      TCHAR *variables, stack_t **stacktop) {
  g_hwndParent=hwndParent;

  EXDLL_INIT();

  {
    TCHAR filename[MAX_PATH];
    char md5_string[33];
    HANDLE hFile;
    md5_byte_t digest[16];

    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 MD5 calculation");
      pushstring(_T(""));
      return;
    }

    if (!FileMD5(hFile, digest)) {
      //pushstring("ERROR: Unable to calculate MD5");
      pushstring(_T(""));
    } else {
      md5_string[32] = '\0';
      MD5ToString(md5_string,digest);
      PushStringA(md5_string);
    }

    CloseHandle(hFile);
  }
}
Ejemplo n.º 11
0
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");
}
Ejemplo n.º 12
0
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);
  }
}
Ejemplo n.º 13
0
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();
}
Ejemplo n.º 14
0
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);
}
extern "C" void __declspec(dllexport) GetMediaCenterPath( HWND hwndParent,
														  int string_size,
														  char *variables,
														  stack_t **stacktop)
{
	EXDLL_INIT();

	HRESULT hr = CoInitialize(NULL);
	char *mediaCenterPath = (char*)GlobalAlloc(GPTR, string_size);
	hr = SHGetFolderPathA( NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, mediaCenterPath );
	setuservariable( INST_0, mediaCenterPath );
}
Ejemplo n.º 16
0
extern "C" void __declspec(dllexport) initDialog(HWND hwndParent, int string_size,
                                      char *variables, stack_t **stacktop)
{
  hMainWindow=hwndParent;
  EXDLL_INIT();
  if (initCalled) {
    pushstring("error");
    return;
  }
  initCalled++;
  createCfgDlg();
}
/**
 * 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);
}
Ejemplo n.º 18
0
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;
  }
}
Ejemplo n.º 19
0
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);
}
Ejemplo n.º 20
0
void __declspec(dllexport) getOSVersion(HWND hwndParent, int string_size, 
	char *variables, stack_t **stacktop,
	extra_parameters *extra)
{
	g_hwndParent=hwndParent;
	EXDLL_INIT();

	{
		OSVERSIONINFO versionInfo;

		ZeroMemory(&versionInfo, sizeof(OSVERSIONINFO));
		versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
		GetVersionEx(&versionInfo);

		pushint(versionInfo.dwMinorVersion);
		pushint(versionInfo.dwMajorVersion);
	}
}
Ejemplo n.º 21
0
/**
 * 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);
}
extern "C" void __declspec(dllexport) RemoveFromGameExplorer( HWND hwndParent,
															  int string_size,
															  char *variables,
															  stack_t **stacktop)
{
	EXDLL_INIT();

	char *cGuid = NULL;
	cGuid = (char*)GlobalAlloc(GPTR, string_size);
	popstring( cGuid );

	HRESULT hr = CoInitialize(NULL);
	if( FAILED(hr) )
	{
        MessageBox( hwndParent, L"Failed to remove Darwinia: Vista Edition from Games Explorer\nCoInitialize Failed", L"Darwinia: Vista Edition", MB_OK|MB_ICONERROR );
		return;
	}

	IGameExplorer *gameExplorerInterface = NULL;
	hr = CoCreateInstance(__uuidof(GameExplorer), 0, CLSCTX_INPROC_SERVER, 
                    __uuidof(IGameExplorer), (LPVOID *)&gameExplorerInterface);

	if( FAILED(hr) )
	{
		MessageBox( hwndParent, L"Failed to remove Darwinia: Vista Edition from Games Explorer\nFailed to create IGameExplorer Instance", L"Darwinia: Vista Edition", MB_OK|MB_ICONERROR );
		return;
	}

	GUID guid = GUID_NULL;
	StringToGuid( &guid, cGuid );
    //CoCreateGuid( &guid );

	hr = gameExplorerInterface->RemoveGame( guid );
	if( FAILED( hr ) )
	{
		MessageBox( hwndParent, L"Failed to remove Darwinia: Vista Edition from Games Explorer\nRemoveGame Failed", L"Darwinia: Vista Edition", MB_OK|MB_ICONERROR );
	}

    RemoveRichSavedGamesW(SAVE_EXTENTION);

	return;
}
Ejemplo n.º 23
0
extern "C" void __declspec(dllexport) write_config_string(
  HWND hwndParent, 
  int string_size, 
	char *variables, 
  stack_t **stacktop)
{
	EXDLL_INIT();
		
	char szFileName[1024]="";
	char szParamName[1024]="";
	char szValue[1024]="";
	popstring(szFileName);
	popstring(szParamName);
	popstring(szValue);	

	//MessageBoxA(NULL, szFileName, szParamName, 0);
	bool bInit = false;
	CConfig config(szFileName, &bInit);
	int nResult = config.writeProfileString(szParamName, szValue);
}
extern "C" void __declspec(dllexport) CheckForVista( HWND hwndParent,
													 int string_size,
													 char *variables,
													 stack_t **stacktop)
{
    EXDLL_INIT();
	OSVERSIONINFOEX versionInfo;
	ZeroMemory(&versionInfo, sizeof(OSVERSIONINFOEX));

	versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
	GetVersionEx( (OSVERSIONINFO *) &versionInfo );

	if ( versionInfo.dwMajorVersion < 6 || 
		 versionInfo.wProductType != VER_NT_WORKSTATION )
	{
		setuservariable( INST_0, "0");
		return;
	}

	setuservariable( INST_0, "1");
}
Ejemplo n.º 25
0
void __declspec(dllexport) GetDotNet30ServicePack(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra) {
	EXDLL_INIT();

	int iNetfx30SPLevel = -1;
	bool bNetfx30Installed = (IsNetfx20Installed() && IsNetfx30Installed() && CheckNetfxVersionUsingMscoree(g_szNetfx20VersionString));
	TCHAR szMessage[MAX_PATH];
	TCHAR szOutputString[MAX_PATH*20];

	if (bNetfx30Installed)
	{
		iNetfx30SPLevel = GetNetfxSPLevel(g_szNetfx30SpRegKeyName, g_szNetfxStandardSPxRegValueName);

		if (iNetfx30SPLevel > 0)
			pushint(iNetfx30SPLevel);
		else
			pushint(-1);
	}
	else
	{
		pushint(-2);
	}
}
Ejemplo n.º 26
0
void __declspec(dllexport) show(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
{
  EXDLL_INIT();

  extra->RegisterPluginCallback(hInstance, PluginCallback);

  {
    DWORD dwThreadId;
    DWORD dwMainThreadId = GetCurrentThreadId();

    hwBanner = NULL;

    if (!IsWindowVisible(hwndParent))
      hwndParent = 0;

    bFailed = FALSE;

    hThread = CreateThread(0, 0, BannerThread, (LPVOID) hwndParent, 0, &dwThreadId);

    // wait for the window to initalize and for the stack operations to finish
    while (hThread && !hwBanner && !bFailed)
    {
      ProcessMessages();
      Sleep(10);
    }

    CloseHandle(hThread);

    if (AttachThreadInput(dwMainThreadId, dwThreadId, TRUE))
    {
      // Activates and displays a window
      ShowWindow(hwBanner, SW_SHOW);
      AttachThreadInput(dwMainThreadId, dwThreadId, FALSE);
    }
    else
      ShowWindow(hwBanner, SW_SHOW);
  }
}
Ejemplo n.º 27
0
extern "C" void __declspec(dllexport) read_config_string(
  HWND hwndParent, 
  int string_size, 
	char *variables, 
  stack_t **stacktop)
{
	EXDLL_INIT();
		
	char szFileName[1024]="";
	char szParamName[1024]="";
	char szValue[1024]="";
	popstring(szFileName);
	popstring(szParamName);	

	//MessageBoxA(NULL, szFileName, szParamName, 0);
	bool bInit = false;
	CConfig config(szFileName, &bInit);
	char* szResult = config.getProfileString(szParamName, szValue, 1024);
	if(szResult!=NULL)
		pushstring(szResult);	
	else
		pushstring("");	
}
Ejemplo n.º 28
0
void __declspec(dllexport) myFunction(HWND hwndParent, int string_size, 
                                      char *variables, stack_t **stacktop,
                                      extra_parameters *extra)
{
  g_hwndParent=hwndParent;

  EXDLL_INIT();


  // note if you want parameters from the stack, pop them off in order.
  // i.e. if you are called via exdll::myFunction file.dat poop.dat
  // calling popstring() the first time would give you file.dat,
  // and the second time would give you poop.dat. 
  // you should empty the stack of your parameters, and ONLY your
  // parameters.

  // do your stuff here
  {
    char buf[1024];
    wsprintf(buf,"$0=%s\n",getuservariable(INST_0));
    MessageBox(g_hwndParent,buf,0,MB_OK);
  }
}
Ejemplo n.º 29
0
extern "C" void __declspec(dllexport) SetImage(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) {
  EXDLL_INIT();

  popstring(temp);
  if (!lstrcmp(temp, "/FILLSCREEN")) {
    x = GetSystemMetrics(SM_CXSCREEN);
    y = GetSystemMetrics(SM_CYSCREEN);
    popstring(temp);
  }
  else x = y = 0;

  BITMAP bitmap;

  if (hBitmap) DeleteObject((HGDIOBJ)hBitmap);
  hBitmap = (HBITMAP)LoadImage(0, temp, IMAGE_BITMAP, x, y, LR_LOADFROMFILE);
  if (!hBitmap) {
    pushstring("can't load bitmap");
    return;
  }

  GetObject(hBitmap, sizeof(bitmap), (LPSTR)&bitmap);
  x = x ? x : bitmap.bmWidth;
  y = y ? y : bitmap.bmHeight;

  if (hWndImage) {
    SetWindowPos(
      hWndImage,
      hWndParent,
      (GetSystemMetrics(SM_CXSCREEN)-x)/2,
      (GetSystemMetrics(SM_CYSCREEN)-y)/2,
      x,
      y,
      SWP_NOACTIVATE
    );
    RedrawWindow(hWndImage, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW);
  }
}
Ejemplo n.º 30
0
extern "C" void __declspec(dllexport) open_folder_dialog(
  HWND hwndParent, 
  int string_size, 
	char *variables, 
  stack_t **stacktop)
{
	EXDLL_INIT();
		
	char szBuffer[1024]="";
	popstring(szBuffer);
	HWND hWndParent = (HWND)atoi(szBuffer);

	CFolderDialog dlg(hWndParent, _T("Select Directory"));
	INT_PTR nResult = dlg.DoModal(hWndParent);
	if(nResult==IDOK)
	{
		CStringA sFolderName = dlg.m_szFolderPath;		
		pushstring(sFolderName.GetBuffer());
	}
	else
	{
		pushstring("");
	}	
}