Esempio n. 1
0
DLLLoader::DLLLoader()
{
	hDll=::LoadLibrary(".\\SendDll.dll");
	if (hDll==NULL)
	{
		cout << "*** WARNING:Can't Find Library SendDll.dll ***" << endl;
		
		return;
	}

	pInit = (PFUN_INIT)::GetProcAddress(hDll,"MC_Init");
	pUnInit = (PFUN_UNINIT)::GetProcAddress(hDll,"MC_UnInit");
	pSend2MC = (PFUN_SEND2MC)::GetProcAddress(hDll,"Send2MC");
	pSend2Dll = (PFUN_SEND2Dll)::GetProcAddress(hDll,"Send2Dll");

	GetPrivateProfileString("Memcached","Host","127.0.0.1:11211",strMCServer,50,"./config.ini");
	BOOL bInit=pInit(strMCServer);
	if (!bInit)
	{
		cout << "*** Init MemCachedClient Failed!" << endl;
	}
	else
	{
		cout << "*** Init MemCachedClient Success..." << endl;
	}
}
Esempio n. 2
0
File: main.c Progetto: bilboed/wine
static void testInit(void)
{
    BOOL (WINAPI *pInit)(DWORD, HANDLE *, AsnObjectIdentifier *);
    BOOL ret;
    HANDLE event;
    AsnObjectIdentifier oid;

    pInit = (void *)GetProcAddress(inetmib1, "SnmpExtensionInit");
    if (!pInit)
    {
        win_skip("no SnmpExtensionInit\n");
        return;
    }
    /* Crash
    ret = pInit(0, NULL, NULL);
    ret = pInit(0, NULL, &oid);
    ret = pInit(0, &event, NULL);
     */
    ret = pInit(0, &event, &oid);
    ok(ret, "SnmpExtensionInit failed: %d\n", GetLastError());
    ok(!strcmp("1.3.6.1.2.1.1", SnmpUtilOidToA(&oid)),
        "Expected 1.3.6.1.2.1.1, got %s\n", SnmpUtilOidToA(&oid));

    SnmpUtilOidFree(&oid);
}
Esempio n. 3
0
int main(void)
{
  int i;
  int num_harness;
  prh_t_hu_harness *current;
  prh_t_hu_outcome outcome;
  
  pInit();
  prh_rfcomm_layer_ctrl(PRH_HOST_BOOT);
  rftest_init_events();

  register_rfcomm_tests();
  current=prh_hu_tests_list_head;
  
  for ( ; current!=NULL; current=current->next)
    {
      printf("%s - number to execute %d\n", current->descr, current->num_tests);    
      for (i=0; i<current->num_tests; i++)
	{
	  if (current->tests[i].pre_test)
	    current->tests[i].pre_test(0, NULL);

	  if (current->tests[i].execute)
	    outcome=current->tests[i].execute(0, NULL);

	  if (current->tests[i].post_test)
	    current->tests[i].post_test(0, NULL);
	  
	  switch(outcome)
	    {
	    case HU_PASSED:
	      current->pass_count++;
	      overall_passed++;
	      break;
	    case HU_FAILED:
	      printf("\n%s failed\n\n", current->tests[i].name);
	      current->fail_count++;
	      overall_failed++;
	      break;
	    case HU_UNRESOLVED:
	      current->unresolved_count++;
	      overall_unresolved++;
	      break;
	    case HU_UNTESTED:
	      current->untested_count++;
	      overall_untested++;
	      break;
	    }
	  current->total_count++;
	  overall_executed++;
	}
      printf("%s - executed %d:  %d passed %d failed\n", current->descr, current->total_count, current->pass_count, current->fail_count);
    }

  printf("Overall - executed %d: %d passed %d failed\n", overall_executed, overall_passed, overall_failed);
  return 0;
}
Esempio n. 4
0
/***************************************************************************//**
 * @brief
 *   Initialize LCD driver
 *
 * @details
 *   This function is called during initialization and when exited from AEM mode
 ******************************************************************************/
void LCD_InitializeDriver(void)
{ int (* pInit) (GUI_DEVICE *);
  pInit = (int (*)(GUI_DEVICE *)) guiDevice->pDeviceAPI->pfGetDevFunc(&guiDevice, LCD_DEVFUNC_INIT);
  pInit(guiDevice);
}
Esempio n. 5
0
bool Module::_LoadDll()
{
    bool bReturn = false;

    if (!m_hInstance)
    {
        // Modules like popup2 like to call SetErrorMode. While that may not be
        // good style, there is little we can do about it. However, LoadLibrary
        // usually produces helpful error messages such as
        // "msvcp70.dll not found" which are not displayed if a module has
        // disabled them via SetErrorMode. We force their display here.
        // First, make Windows display all errors
        UINT uOldMode = SetErrorMode(0);

        if ((m_hInstance = LoadLibraryW(m_wzLocation.c_str())) != nullptr)
        {
            AssignToFunction(m_pInit, (initModuleProc) GetProcAddress(
                m_hInstance, "initModuleW"));

            if (!m_pInit) // Might be a legacy module, check for initModuleEx
            {
                initModuleProcA pInit = (initModuleProcA)GetProcAddress(
                    m_hInstance, "initModuleEx");

                if (!pInit) // Might be a BC module, check for underscore
                {
                    pInit = (initModuleProcA)GetProcAddress(
                        m_hInstance, "_initModuleEx");
                }

                if (pInit)
                {
                    m_pInit = [pInit] (HWND hWnd, HINSTANCE hInst, LPCWSTR pwzPath) -> int {
                        char szPath[MAX_PATH];
                        WideCharToMultiByte(CP_ACP, 0, pwzPath, -1,
                            szPath, sizeof(szPath), "", nullptr);
                        return pInit(hWnd, hInst, szPath);
                    };
                }
            }

            m_pQuit = (quitModuleProc)GetProcAddress(
                m_hInstance, "quitModule");

            if (!m_pQuit)   // Might be a BC module, check for underscore
            {
                m_pQuit = (quitModuleProc)GetProcAddress(
                    m_hInstance, "_quitModule");
            }

            if (m_pInit == nullptr)
            {
                RESOURCE_STR(nullptr, IDS_INITMODULEEXNOTFOUND_ERROR,
                    L"Error: Could not find initModule().\n"
                    L"\n"
                    L"Please confirm that the dll is a LiteStep module,\n"
                    L"and check with the author for updates.");
            }
            else if (m_pQuit == nullptr)
            {
                RESOURCE_STR(nullptr, IDS_QUITMODULENOTFOUND_ERROR,
                    L"Error: Could not find quitModule().\n"
                    L"\n"
                    L"Please confirm that the dll is a LiteStep module.");
            }
            else
            {
                bReturn = true;
            }
        }
        else
        {
            HRESULT hrError = HrGetLastError();

#if defined(_WIN64)
            if (GetModuleArchitecture(m_wzLocation.c_str()) == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
            {
                RESOURCE_STR(nullptr, IDS_MODULEWRONGARCH64_ERROR,
                    L"Error: Could not load module.\n"
                    L"\n"
                    L"The module seems to compiled for 32-bit LiteStep. This is a 64-bit version of LiteStep, which can only load 64-bit modules.");
            }
#else
            if (GetModuleArchitecture(m_wzLocation.c_str()) == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
            {
                RESOURCE_STR(nullptr, IDS_MODULEWRONGARCH32_ERROR,
                    L"Error: Could not load module.\n"
                    L"\n"
                    L"The module seems to compiled for 64-bit LiteStep. This is a 32-bit version of LiteStep, which can only load 32-bit modules.");
            }
#endif
            else if (PathFileExistsW(m_wzLocation.c_str()))
            {
                RESOURCE_STR(nullptr, IDS_MODULEDEPENDENCY_ERROR,
                    L"Error: Could not load module.\n"
                    L"\n"
                    L"This is likely a case of a missing C Run-Time Library"
                    L"or other dependency."
                    L"\n"
                    L"Error Information:"
                    L"\n");

                size_t nLen = 0;
                StringCchLengthW(resourceTextBuffer, _countof(resourceTextBuffer), &nLen);
                DescriptionFromHR(hrError, resourceTextBuffer + nLen, _countof(resourceTextBuffer) - nLen);
            }
            else
            {
                RESOURCE_STR(nullptr, IDS_MODULENOTFOUND_ERROR,
                    L"Error: Could not locate module.\n"
                    L"\n"
                    L"Please check your configuration.");
            }
        }

        // Second, restore the old state
        SetErrorMode(uOldMode);

        if (!bReturn)
        {
            LPCWSTR pwzFileName = PathFindFileNameW(m_wzLocation.c_str());

            RESOURCE_MSGBOX_F(pwzFileName, MB_ICONERROR);

            if (m_hInstance)
            {
                FreeLibrary(m_hInstance);
                m_hInstance = nullptr;
            }
        }
    }

    return bReturn;
}