这篇教程C++ GetModuleHandleW函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetModuleHandleW函数的典型用法代码示例。如果您正苦于以下问题:C++ GetModuleHandleW函数的具体用法?C++ GetModuleHandleW怎么用?C++ GetModuleHandleW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetModuleHandleW函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: InitPatchesstatic void InitPatches(){ LOGGING_DEBUG(lg) << "Patches initialization started."; // Syntax check patch LOGGING_TRACE(lg) << "Installing syntax check patch"; INSTALL_PATCH(syntaxCheck); // Auto disable trigger patch LOGGING_TRACE(lg) << "Installing auto disable patch"; INSTALL_PATCH(autoDisable); // Enable trigger check patch LOGGING_TRACE(lg) << "Installing enable trigger check patch"; INSTALL_PATCH(enableTriggerCheck1); INSTALL_PATCH(enableTriggerCheck2); LOGGING_TRACE(lg) << "Installing doodad limit patch"; INSTALL_PATCH(doodadLimit); LOGGING_TRACE(lg) << "Installing unit/item limit patch"; INSTALL_PATCH(unitItemLimit); LOGGING_TRACE(lg) << "Installing editor multi-instance patch"; INSTALL_PATCH(editorInstanceCheck); LOGGING_TRACE(lg) << "Installing attack table patch"; base::win::pe_reader module(GetModuleHandleW(NULL));#define WE_ADDRESS(ADDR) ((uintptr_t)(ADDR) - 0x00400000 + (uintptr_t)module.module()) enum ATTACK_TABLE { WESTRING_UE_ATTACKTYPE_SPELLS = 0, WESTRING_UE_ATTACKTYPE_NORMAL, WESTRING_UE_ATTACKTYPE_PIERCE, WESTRING_UE_ATTACKTYPE_SIEGE, WESTRING_UE_ATTACKTYPE_MAGIC, WESTRING_UE_ATTACKTYPE_CHAOS, WESTRING_UE_ATTACKTYPE_HERO, }; uintptr_t attack_table_string[] = { WE_ADDRESS(0x007DF394), WE_ADDRESS(0x007DF374), WE_ADDRESS(0x007DF354), WE_ADDRESS(0x007DF334), WE_ADDRESS(0x007DF314), WE_ADDRESS(0x007DF2F4), WE_ADDRESS(0x007DF2D8), }; uintptr_t ptr = WE_ADDRESS(0x00784488); base::hook::replace_pointer(ptr, attack_table_string[WESTRING_UE_ATTACKTYPE_NORMAL]); ptr += 4; base::hook::replace_pointer(ptr, attack_table_string[WESTRING_UE_ATTACKTYPE_PIERCE]); ptr += 4; base::hook::replace_pointer(ptr, attack_table_string[WESTRING_UE_ATTACKTYPE_SIEGE]); ptr += 4; base::hook::replace_pointer(ptr, attack_table_string[WESTRING_UE_ATTACKTYPE_MAGIC]); ptr += 4; base::hook::replace_pointer(ptr, attack_table_string[WESTRING_UE_ATTACKTYPE_CHAOS]); ptr += 4; base::hook::replace_pointer(ptr, attack_table_string[WESTRING_UE_ATTACKTYPE_SPELLS]); ptr += 4; base::hook::replace_pointer(ptr, attack_table_string[WESTRING_UE_ATTACKTYPE_HERO]); ptr += 4;#undef WE_ADDRESS LOGGING_DEBUG(lg) << "Patches initialization completed.";}
开发者ID:chanchancl,项目名称:YDWE,代码行数:64,
示例2: vo_w32_init/** * /brief Initialize w32_common framework. * * The first function that should be called from the w32_common framework. * It handles window creation on the screen with proper title and attributes. * It also initializes the framework's internal variables. The function should * be called after your own preinit initialization and you shouldn't do any * window management on your own. * * Global libvo variables changed: * vo_w32_window * vo_screenwidth * vo_screenheight * * /return 1 = Success, 0 = Failure */int vo_w32_init(struct vo *vo){ assert(!vo->w32); struct vo_w32_state *w32 = talloc_zero(vo, struct vo_w32_state); vo->w32 = w32; HINSTANCE hInstance = GetModuleHandleW(NULL); HICON mplayerIcon = LoadIconW(hInstance, L"IDI_ICON1"); WNDCLASSEXW wcex = { .cbSize = sizeof wcex, .style = CS_OWNDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, .lpfnWndProc = WndProc, .hInstance = hInstance, .hIcon = mplayerIcon, .hCursor = LoadCursor(NULL, IDC_ARROW), .lpszClassName = classname, .hIconSm = mplayerIcon, }; if (!RegisterClassExW(&wcex)) { MP_ERR(vo, "win32: unable to register window class!/n"); return 0; } if (vo->opts->WinID >= 0) { RECT r; GetClientRect(WIN_ID_TO_HWND(vo->opts->WinID), &r); vo->dwidth = r.right; vo->dheight = r.bottom; w32->window = CreateWindowExW(WS_EX_NOPARENTNOTIFY, classname, classname, WS_CHILD | WS_VISIBLE, 0, 0, vo->dwidth, vo->dheight, WIN_ID_TO_HWND(vo->opts->WinID), 0, hInstance, vo); } else { w32->window = CreateWindowExW(0, classname, classname, update_style(vo, 0), CW_USEDEFAULT, 0, 100, 100, 0, 0, hInstance, vo); } if (!w32->window) { MP_ERR(vo, "win32: unable to create window!/n"); return 0; } w32->tracking = FALSE; w32->trackEvent = (TRACKMOUSEEVENT){ .cbSize = sizeof(TRACKMOUSEEVENT), .dwFlags = TME_LEAVE, .hwndTrack = w32->window, }; if (vo->opts->WinID >= 0) EnableWindow(w32->window, 0); w32->cursor_visible = true; // we don't have proper event handling vo->wakeup_period = 0.02; updateScreenProperties(vo); MP_VERBOSE(vo, "win32: running at %dx%d/n", vo->opts->screenwidth, vo->opts->screenheight); return 1;}/** * /brief Toogle fullscreen / windowed mode. * * Should be called on VOCTRL_FULLSCREEN event. The window is * always resized during this call, so the rendering context * should be reinitialized with the new dimensions. * It is unspecified if vo_check_events will create a resize * event in addition or not. */static void vo_w32_fullscreen(struct vo *vo){//.........这里部分代码省略.........
开发者ID:benf,项目名称:mpv,代码行数:101,
示例3: definedbool StQuadBufferCheck::testQuadBufferSupport() {#ifdef ST_HAVE_EGL return false; // unsupported at all!#elif defined(_WIN32) HINSTANCE anAppInst = GetModuleHandleW(NULL); // Holds The Instance Of The Application const StStringUtfWide QUAD_TEST_CLASS = L"StTESTQuadBufferWin"; if(!wndRegisterClass(anAppInst, QUAD_TEST_CLASS)) { ST_DEBUG_LOG_AT("Fail to register class"); return false; } HWND aWindow = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE | WS_EX_NOACTIVATE, QUAD_TEST_CLASS.toCString(), L"GL Quad Buffer test", WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_DISABLED, 32, 32, 32, 32, NULL, NULL, anAppInst, NULL); if(aWindow == NULL) { UnregisterClassW(QUAD_TEST_CLASS.toCString(), anAppInst); return false; } HDC aDevCtx = GetDC(aWindow); if(aDevCtx == NULL) { // Did We Get A Device Context? ST_DEBUG_LOG_AT(L"WinAPI, Can't create Device Context for the entire screen"); DestroyWindow(aWindow); UnregisterClassW(QUAD_TEST_CLASS.toCString(), anAppInst); return false; } PIXELFORMATDESCRIPTOR aPixelFormat; memset(&aPixelFormat, 0, sizeof(PIXELFORMATDESCRIPTOR)); // zero out all fields aPixelFormat.nSize = sizeof(PIXELFORMATDESCRIPTOR); aPixelFormat.nVersion = 1; aPixelFormat.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_STEREO; const int aPixelFormatId = ChoosePixelFormat(aDevCtx, &aPixelFormat); DescribePixelFormat(aDevCtx, aPixelFormatId, sizeof(PIXELFORMATDESCRIPTOR), &aPixelFormat); // clean up if(ReleaseDC(aWindow, aDevCtx) == 0) { ST_DEBUG_LOG_AT(L"WinAPI, ReleaseDC(aWindow, aDevCtx) FAILED"); } DestroyWindow(aWindow); UnregisterClassW(QUAD_TEST_CLASS.toCString(), anAppInst); return (aPixelFormat.dwFlags & PFD_STEREO) != 0;#elif defined(__linux__) Display* hDisplay = XOpenDisplay(NULL); // get first display on server from DISPLAY in env if(hDisplay == NULL) { ST_DEBUG_LOG_AT("X: could not open display"); return false; } // make sure OpenGL's GLX extension supported int dummy = 0; if(!glXQueryExtension(hDisplay, &dummy, &dummy)) { ST_DEBUG_LOG_AT("X: server has no OpenGL GLX extension"); return false; } static int quadBuff[] = { GLX_RGBA, GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, GLX_STEREO, None }; // find an appropriate visual XVisualInfo* vi = glXChooseVisual(hDisplay, DefaultScreen(hDisplay), quadBuff); return vi != NULL;#endif}
开发者ID:gkv311,项目名称:sview,代码行数:72,
示例4: GetModuleHandleW/// <summary>/// Load function into database/// </summary>/// <param name="name">Function name</param>/// <param name="module">Module name</param>/// <returns>true on success</returns>FARPROC DynImport::load( const std::string& name, const std::wstring& module ){ auto mod = GetModuleHandleW( module.c_str() ); return load( name, mod );}
开发者ID:misoag,项目名称:Blackbone,代码行数:11,
示例5: detectCDThreadstatic DWORD WINAPI detectCDThread(LPVOID lpParameter){ const char *classname = "PhysicsFSDetectCDCatcher"; const char *winname = "PhysicsFSDetectCDMsgWindow"; HINSTANCE hInstance = GetModuleHandleW(NULL); ATOM class_atom = 0; WNDCLASSEXA wce; MSG msg; memset(&wce, '/0', sizeof (wce)); wce.cbSize = sizeof (wce); wce.lpfnWndProc = detectCDWndProc; wce.lpszClassName = classname; wce.hInstance = hInstance; class_atom = RegisterClassExA(&wce); if (class_atom == 0) { initialDiscDetectionComplete = 1; /* let main thread go on. */ return 0; } /* if */ detectCDHwnd = CreateWindowExA(0, classname, winname, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInstance, NULL); if (detectCDHwnd == NULL) { initialDiscDetectionComplete = 1; /* let main thread go on. */ UnregisterClassA(classname, hInstance); return 0; } /* if */ /* We'll get events when discs come and go from now on. */ /* Do initial detection, possibly blocking awhile... */ drivesWithMediaBitmap = pollDiscDrives(); initialDiscDetectionComplete = 1; /* let main thread go on. */ do { const BOOL rc = GetMessageW(&msg, detectCDHwnd, 0, 0); if ((rc == 0) || (rc == -1)) break; /* don't care if WM_QUIT or error break this loop. */ TranslateMessage(&msg); DispatchMessageW(&msg); } while (1); /* we've been asked to quit. */ DestroyWindow(detectCDHwnd); do { const BOOL rc = GetMessage(&msg, detectCDHwnd, 0, 0); if ((rc == 0) || (rc == -1)) break; TranslateMessage(&msg); DispatchMessageW(&msg); } while (1); UnregisterClassA(classname, hInstance); return 0;} /* detectCDThread */
开发者ID:pixelballoon,项目名称:pixelboost-dependencies,代码行数:63,
示例6: _gdk_win32_enable_hidpistatic void_gdk_win32_enable_hidpi (GdkWin32Display *display){ gboolean check_for_dpi_awareness = FALSE; gboolean have_hpi_disable_envvar = FALSE; enum dpi_aware_status { DPI_STATUS_PENDING, DPI_STATUS_SUCCESS, DPI_STATUS_DISABLED, DPI_STATUS_FAILED } status = DPI_STATUS_PENDING; if (g_win32_check_windows_version (6, 3, 0, G_WIN32_OS_ANY)) { /* If we are on Windows 8.1 or later, cache up functions from shcore.dll, by all means */ display->have_at_least_win81 = TRUE; display->shcore_funcs.hshcore = LoadLibraryW (L"shcore.dll"); if (display->shcore_funcs.hshcore != NULL) { display->shcore_funcs.setDpiAwareFunc = (funcSetProcessDpiAwareness) GetProcAddress (display->shcore_funcs.hshcore, "SetProcessDpiAwareness"); display->shcore_funcs.getDpiAwareFunc = (funcGetProcessDpiAwareness) GetProcAddress (display->shcore_funcs.hshcore, "GetProcessDpiAwareness"); display->shcore_funcs.getDpiForMonitorFunc = (funcGetDpiForMonitor) GetProcAddress (display->shcore_funcs.hshcore, "GetDpiForMonitor"); } } else { /* Windows Vista through 8: use functions from user32.dll directly */ HMODULE user32; display->have_at_least_win81 = FALSE; user32 = GetModuleHandleW (L"user32.dll"); if (user32 != NULL) { display->user32_dpi_funcs.setDpiAwareFunc = (funcSetProcessDPIAware) GetProcAddress (user32, "SetProcessDPIAware"); display->user32_dpi_funcs.isDpiAwareFunc = (funcIsProcessDPIAware) GetProcAddress (user32, "IsProcessDPIAware"); } } if (g_getenv ("GDK_WIN32_DISABLE_HIDPI") == NULL) { /* For Windows 8.1 and later, use SetProcessDPIAwareness() */ if (display->have_at_least_win81) { /* then make the GDK-using app DPI-aware */ if (display->shcore_funcs.setDpiAwareFunc != NULL) { GdkWin32ProcessDpiAwareness hidpi_mode; /* TODO: See how per-monitor DPI awareness is done by the Wayland backend */ if (g_getenv ("GDK_WIN32_PER_MONITOR_HIDPI") != NULL) hidpi_mode = PROCESS_PER_MONITOR_DPI_AWARE; else hidpi_mode = PROCESS_SYSTEM_DPI_AWARE; switch (display->shcore_funcs.setDpiAwareFunc (hidpi_mode)) { case S_OK: display->dpi_aware_type = hidpi_mode; status = DPI_STATUS_SUCCESS; break; case E_ACCESSDENIED: /* This means the app used a manifest to set DPI awareness, or a DPI compatibility setting is used. The manifest is the trump card in this game of bridge here. The same applies if one uses the control panel or program properties to force system DPI awareness */ check_for_dpi_awareness = TRUE; break; default: display->dpi_aware_type = PROCESS_DPI_UNAWARE; status = DPI_STATUS_FAILED; break; } } else { check_for_dpi_awareness = TRUE; } } else { /* For Windows Vista through 8, use SetProcessDPIAware() */ display->have_at_least_win81 = FALSE; if (display->user32_dpi_funcs.setDpiAwareFunc != NULL) { if (display->user32_dpi_funcs.setDpiAwareFunc () != 0) { display->dpi_aware_type = PROCESS_SYSTEM_DPI_AWARE;//.........这里部分代码省略.........
开发者ID:sam-m888,项目名称:gtk,代码行数:101,
示例7: GetModuleHandleWbool CWebWindow::_createWindow(HWND parent, unsigned styles, unsigned styleEx, int x, int y, int width, int height){ if (IsWindow(m_hwnd)) return true; const wchar_t* szClassName = L"wkeWebWindow"; MSG msg = { 0 }; WNDCLASSW wndClass = { 0 }; if (!GetClassInfoW(NULL, szClassName, &wndClass)) { wndClass.style = CS_HREDRAW | CS_VREDRAW; wndClass.lpfnWndProc = &CWebWindow::_staticWindowProc; wndClass.cbClsExtra = 200; wndClass.cbWndExtra = 200; wndClass.hInstance = GetModuleHandleW(NULL); wndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); wndClass.hCursor = LoadCursor(NULL, IDC_ARROW); wndClass.hbrBackground= NULL; wndClass.lpszMenuName = NULL; wndClass.lpszClassName = szClassName; RegisterClassW(&wndClass); } //DWORD styleEx = 0; //DWORD styles = 0; //if (WKE_WINDOW_STYLE_LAYERED == (styleFlags & WKE_WINDOW_STYLE_LAYERED)) // styleEx = WS_EX_LAYERED; //if (WKE_WINDOW_STYLE_CHILD == (styleFlags & WKE_WINDOW_STYLE_CHILD)) // styles |= WS_CHILD; //else // styles |= WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME; //if (WKE_WINDOW_STYLE_BORDER == (styleFlags & WKE_WINDOW_STYLE_BORDER)) // styles |= WS_BORDER; //if (WKE_WINDOW_STYLE_CAPTION == (styleFlags & WKE_WINDOW_STYLE_CAPTION)) // styles |= WS_CAPTION; //if (WKE_WINDOW_STYLE_SIZEBOX == (styleFlags & WKE_WINDOW_STYLE_SIZEBOX)) // styles |= WS_SIZEBOX; //if (WKE_WINDOW_STYLE_SHOWLOADING == (styleFlags & WKE_WINDOW_STYLE_SHOWLOADING)) // styles |= WS_VISIBLE; m_hwnd = CreateWindowExW( styleEx, // window ex-style szClassName, // window class name L"wkeWebWindow", // window caption styles, // window style x, // initial x position y, // initial y position width, // initial x size height, // initial y size parent, // parent window handle NULL, // window menu handle GetModuleHandleW(NULL), // program instance handle this); // creation parameters if (!IsWindow(m_hwnd)) return FALSE; CWebView::setHostWindow(m_hwnd); CWebView::resize(width, height); return TRUE;}
开发者ID:YangAtC,项目名称:wke,代码行数:68,
示例8: createWindow// Creates the GLFW window and rendering context//static int createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig){ int xpos, ypos, fullWidth, fullHeight; WCHAR* wideTitle; if (wndconfig->monitor) { GLFWvidmode mode; // NOTE: This window placement is temporary and approximate, as the // correct position and size cannot be known until the monitor // video mode has been set _glfwPlatformGetMonitorPos(wndconfig->monitor, &xpos, &ypos); _glfwPlatformGetVideoMode(wndconfig->monitor, &mode); fullWidth = mode.width; fullHeight = mode.height; } else { xpos = CW_USEDEFAULT; ypos = CW_USEDEFAULT; getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), wndconfig->width, wndconfig->height, &fullWidth, &fullHeight); } wideTitle = _glfwCreateWideStringFromUTF8(wndconfig->title); if (!wideTitle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to convert window title to UTF-16"); return GLFW_FALSE; } window->win32.handle = CreateWindowExW(getWindowExStyle(window), _GLFW_WNDCLASSNAME, wideTitle, getWindowStyle(window), xpos, ypos, fullWidth, fullHeight, NULL, // No parent window NULL, // No window menu GetModuleHandleW(NULL), window); // Pass object to WM_CREATE free(wideTitle); if (!window->win32.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create window"); return GLFW_FALSE; } if (_glfw_ChangeWindowMessageFilterEx) { _glfw_ChangeWindowMessageFilterEx(window->win32.handle, WM_DROPFILES, MSGFLT_ALLOW, NULL); _glfw_ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYDATA, MSGFLT_ALLOW, NULL); _glfw_ChangeWindowMessageFilterEx(window->win32.handle, WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL); } if (wndconfig->floating && !wndconfig->monitor) { SetWindowPos(window->win32.handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); } DragAcceptFiles(window->win32.handle, TRUE); window->win32.minwidth = GLFW_DONT_CARE; window->win32.minheight = GLFW_DONT_CARE; window->win32.maxwidth = GLFW_DONT_CARE; window->win32.maxheight = GLFW_DONT_CARE; window->win32.numer = GLFW_DONT_CARE; window->win32.denom = GLFW_DONT_CARE; return GLFW_TRUE;}
开发者ID:netcrack,项目名称:glfw,代码行数:85,
示例9: or_address_value_4int or_address_value_4(__in void* pAddress){ WNDCLASSEXW stWC = { 0 }; HWND hWndParent = NULL; HWND hWndChild = NULL; WCHAR* pszClassName = L"cve-2016-7255"; WCHAR* pszTitleName = L"cve-2016-7255"; void* pId = NULL; MSG stMsg = { 0 }; UINT64 value = 0; do { stWC.cbSize = sizeof(stWC); stWC.lpfnWndProc = DefWindowProcW; stWC.lpszClassName = pszClassName; if (0 == RegisterClassExW(&stWC)) { break; } hWndParent = CreateWindowExW( 0, pszClassName, NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 360, 360, NULL, NULL, GetModuleHandleW(NULL), NULL ); if (NULL == hWndParent) { break; } hWndChild = CreateWindowExW( 0, pszClassName, pszTitleName, WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CHILD, 0, 0, 160, 160, hWndParent, NULL, GetModuleHandleW(NULL), NULL ); if (NULL == hWndChild) { break; }#ifdef _WIN64 pId = ((UCHAR*)pAddress - 0x28);#else pId = ((UCHAR*)pAddress - 0x14);#endif // #ifdef _WIN64 SetWindowLongPtr(hWndChild, GWLP_ID, (LONG_PTR)pId); DbgPrint("hWndChild = 0x%p/n", hWndChild); ShowWindow(hWndParent, SW_SHOWNORMAL); SetParent(hWndChild, GetDesktopWindow()); SetForegroundWindow(hWndChild); _sim_alt_shift_tab(4); SwitchToThisWindow(hWndChild, TRUE); _sim_alt_shift_esc(); while (GetMessage(&stMsg, NULL, 0, 0)) { SetFocus(hWndParent); _sim_alt_esc(20); SetFocus(hWndChild); _sim_alt_esc(20); TranslateMessage(&stMsg); DispatchMessage(&stMsg); if (value != 0) {//.........这里部分代码省略.........
开发者ID:AlexxNica,项目名称:exploit-database,代码行数:101,
示例10: ApplicationPageOnNotifyvoid ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam){ LPNMHDR pnmh; LV_DISPINFO* pnmdi; LPAPPLICATION_PAGE_LIST_ITEM pAPLI; WCHAR szMsg[256]; pnmh = (LPNMHDR) lParam; pnmdi = (LV_DISPINFO*) lParam; if (pnmh->hwndFrom == hApplicationPageListCtrl) { switch (pnmh->code) { case LVN_ITEMCHANGED: ApplicationPageUpdate(); break; case LVN_GETDISPINFO: pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)pnmdi->item.lParam; /* Update the item text */ if (pnmdi->item.iSubItem == 0) { wcsncpy(pnmdi->item.pszText, pAPLI->szTitle, pnmdi->item.cchTextMax); } /* Update the item status */ else if (pnmdi->item.iSubItem == 1) { if (pAPLI->bHung) { LoadStringW( GetModuleHandleW(NULL), IDS_NOT_RESPONDING , szMsg, sizeof(szMsg) / sizeof(szMsg[0])); } else { LoadStringW( GetModuleHandleW(NULL), IDS_RUNNING, (LPWSTR) szMsg, sizeof(szMsg) / sizeof(szMsg[0])); } wcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax); } break; case NM_RCLICK: if (ListView_GetSelectedCount(hApplicationPageListCtrl) < 1) { ApplicationPageShowContextMenu1(); } else { ApplicationPageShowContextMenu2(); } break; case NM_DBLCLK: ApplicationPage_OnSwitchTo(); break; case LVN_KEYDOWN: if (((LPNMLVKEYDOWN)lParam)->wVKey == VK_DELETE) ApplicationPage_OnEndTask(); break; } } else if (pnmh->hwndFrom == ListView_GetHeader(hApplicationPageListCtrl)) { switch (pnmh->code) { case NM_RCLICK: if (ListView_GetSelectedCount(hApplicationPageListCtrl) < 1) { ApplicationPageShowContextMenu1(); } else { ApplicationPageShowContextMenu2(); } break; case HDN_ITEMCLICK: (void)ListView_SortItems(hApplicationPageListCtrl, ApplicationPageCompareFunc, 0); bSortAscending = !bSortAscending; break; } }}
开发者ID:hoangduit,项目名称:reactos,代码行数:96,
示例11: Test_SetCursorPosvoid Test_SetCursorPos(){ HWND hwnd; MSG msg; int i; memset(results, sizeof(results), 0); hMouseHookLL = SetWindowsHookEx(WH_MOUSE_LL, MouseLLHookProc, GetModuleHandleA( NULL ), 0); hMouseHook = SetWindowsHookExW(WH_MOUSE, MouseHookProc, GetModuleHandleW( NULL ), GetCurrentThreadId()); ok(hMouseHook!=NULL,"failed to set hook/n"); ok(hMouseHookLL!=NULL,"failed to set hook/n"); test_no = 0; SetCursorPos(1,1); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 1; mouse_event(MOUSEEVENTF_MOVE, 2,2, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); hwnd = CreateTestWindow(); SetCapture(hwnd); test_no = 2; SetCursorPos(50,50); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 3; mouse_event(MOUSEEVENTF_MOVE, 100,100, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 4; SetCursorPos(50,50); SetCursorPos(60,60); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 5; SetCursorPos(50,50); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); SetCursorPos(60,60); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 6; mouse_event(MOUSEEVENTF_MOVE, 50,50, 0,0); mouse_event(MOUSEEVENTF_MOVE, 60,60, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); test_no = 7; mouse_event(MOUSEEVENTF_MOVE, 50,50, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); mouse_event(MOUSEEVENTF_MOVE, 60,60, 0,0); while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); for(i = 0; i< 8; i++) {#define TEST(s,x,y) ok(y == x, "%d: %s called %d times instead of %d/n",i,s, y,x); TEST("WH_MOUSE_LL", info[i].ll_hook_called, results[i].ll_hook_called); /* WH_MOUSE results vary greatly among windows versions */ //TEST("WH_MOUSE", info[i].hook_called, results[i].hook_called); TEST("WM_MOUSEMOVE", info[i].mouse_move_called, results[i].mouse_move_called); } SetCapture(NULL); DestroyWindow(hwnd); UnhookWindowsHookEx (hMouseHook); UnhookWindowsHookEx (hMouseHookLL);}
开发者ID:mutoso-mirrors,项目名称:reactos,代码行数:70,
示例12: _CorExeMain__int32 WINAPI _CorExeMain(void){ int exit_code; int argc; char **argv; MonoDomain *domain=NULL; MonoImage *image; MonoImageOpenStatus status; MonoAssembly *assembly=NULL; WCHAR filename[MAX_PATH]; char *filenameA; ICLRRuntimeInfo *info; RuntimeHost *host; HRESULT hr; int i; get_utf8_args(&argc, &argv); GetModuleFileNameW(NULL, filename, MAX_PATH); TRACE("%s", debugstr_w(filename)); for (i=0; i<argc; i++) TRACE(" %s", debugstr_a(argv[i])); TRACE("/n"); filenameA = WtoA(filename); if (!filenameA) return -1; FixupVTable(GetModuleHandleW(NULL)); hr = get_runtime_info(filename, NULL, NULL, 0, 0, FALSE, &info); if (SUCCEEDED(hr)) { hr = ICLRRuntimeInfo_GetRuntimeHost(info, &host); if (SUCCEEDED(hr)) hr = RuntimeHost_GetDefaultDomain(host, &domain); if (SUCCEEDED(hr)) { image = mono_image_open_from_module_handle(GetModuleHandleW(NULL), filenameA, 1, &status); if (image) assembly = mono_assembly_load_from(image, filenameA, &status); if (assembly) { mono_trace_set_assembly(assembly); exit_code = mono_jit_exec(domain, assembly, argc, argv); } else { ERR("couldn't load %s, status=%d/n", debugstr_w(filename), status); exit_code = -1; } RuntimeHost_DeleteDomain(host, domain); } else exit_code = -1; ICLRRuntimeInfo_Release(info); } else exit_code = -1; HeapFree(GetProcessHeap(), 0, argv); if (domain) { mono_thread_manage(); mono_jit_cleanup(domain); } return exit_code;}
开发者ID:DeltaYang,项目名称:wine,代码行数:80,
示例13: IntInitializeImmEntryTable/* * @unimplemented */BOOL WINAPI IntInitializeImmEntryTable(VOID){ WCHAR ImmFile[MAX_PATH]; HMODULE imm32 = ghImm32; if (gImmApiEntries.pImmIsIME != 0) { ERR("Imm Api Table Init 1/n"); return TRUE; } GetImmFileName(ImmFile, sizeof(ImmFile)); TRACE("File %ws/n",ImmFile); if (imm32 == NULL) { imm32 = GetModuleHandleW(ImmFile); } if (imm32 == NULL) { imm32 = ghImm32 = LoadLibraryW(ImmFile); if (imm32 == NULL) { ERR("Did not load!/n"); return FALSE; } return TRUE; } if (ImmApiTableZero) { ImmApiTableZero = FALSE; ZeroMemory(&gImmApiEntries, sizeof(Imm32ApiTable)); } gImmApiEntries.pImmIsIME = (BOOL (WINAPI*)(HKL)) GetProcAddress(imm32, "ImmIsIME"); if (!gImmApiEntries.pImmIsIME) gImmApiEntries.pImmIsIME = IMM_ImmIsIME; gImmApiEntries.pImmEscapeA = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(imm32, "ImmEscapeA"); if (!gImmApiEntries.pImmEscapeA) gImmApiEntries.pImmEscapeA = IMM_ImmEscapeAW; gImmApiEntries.pImmEscapeW = (LRESULT (WINAPI*)(HKL, HIMC, UINT, LPVOID)) GetProcAddress(imm32, "ImmEscapeW"); if (!gImmApiEntries.pImmEscapeW) gImmApiEntries.pImmEscapeW = IMM_ImmEscapeAW; gImmApiEntries.pImmGetCompositionStringA = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(imm32, "ImmGetCompositionStringA"); if (!gImmApiEntries.pImmGetCompositionStringA) gImmApiEntries.pImmGetCompositionStringA = IMM_ImmGetCompositionStringAW; gImmApiEntries.pImmGetCompositionStringW = (LONG (WINAPI*)(HIMC, DWORD, LPVOID, DWORD)) GetProcAddress(imm32, "ImmGetCompositionStringW"); if (!gImmApiEntries.pImmGetCompositionStringW) gImmApiEntries.pImmGetCompositionStringW = IMM_ImmGetCompositionStringAW; gImmApiEntries.pImmGetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(imm32, "ImmGetCompositionFontA"); if (!gImmApiEntries.pImmGetCompositionFontA) gImmApiEntries.pImmGetCompositionFontA = IMM_ImmGetCompositionFontA; gImmApiEntries.pImmGetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(imm32, "ImmGetCompositionFontW"); if (!gImmApiEntries.pImmGetCompositionFontW) gImmApiEntries.pImmGetCompositionFontW = IMM_ImmGetCompositionFontW; gImmApiEntries.pImmSetCompositionFontA = (BOOL (WINAPI*)(HIMC, LPLOGFONTA)) GetProcAddress(imm32, "ImmSetCompositionFontA"); if (!gImmApiEntries.pImmSetCompositionFontA) gImmApiEntries.pImmSetCompositionFontA = IMM_ImmSetCompositionFontA; gImmApiEntries.pImmSetCompositionFontW = (BOOL (WINAPI*)(HIMC, LPLOGFONTW)) GetProcAddress(imm32, "ImmSetCompositionFontW"); if (!gImmApiEntries.pImmSetCompositionFontW) gImmApiEntries.pImmSetCompositionFontW = IMM_ImmSetCompositionFontW; gImmApiEntries.pImmGetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(imm32, "ImmGetCompositionWindow"); if (!gImmApiEntries.pImmGetCompositionWindow) gImmApiEntries.pImmGetCompositionWindow = IMM_ImmSetGetCompositionWindow; gImmApiEntries.pImmSetCompositionWindow = (BOOL (WINAPI*)(HIMC, LPCOMPOSITIONFORM)) GetProcAddress(imm32, "ImmSetCompositionWindow"); if (!gImmApiEntries.pImmSetCompositionWindow) gImmApiEntries.pImmSetCompositionWindow = IMM_ImmSetGetCompositionWindow; gImmApiEntries.pImmAssociateContext = (HIMC (WINAPI*)(HWND, HIMC)) GetProcAddress(imm32, "ImmAssociateContext"); if (!gImmApiEntries.pImmAssociateContext) gImmApiEntries.pImmAssociateContext = IMM_ImmAssociateContext; gImmApiEntries.pImmReleaseContext = (BOOL (WINAPI*)(HWND, HIMC)) GetProcAddress(imm32, "ImmReleaseContext"); if (!gImmApiEntries.pImmReleaseContext) gImmApiEntries.pImmReleaseContext = IMM_ImmReleaseContext; gImmApiEntries.pImmGetContext = (HIMC (WINAPI*)(HWND)) GetProcAddress(imm32, "ImmGetContext"); if (!gImmApiEntries.pImmGetContext) gImmApiEntries.pImmGetContext = IMM_ImmGetContext; gImmApiEntries.pImmGetDefaultIMEWnd = (HWND (WINAPI*)(HWND)) GetProcAddress(imm32, "ImmGetDefaultIMEWnd"); if (!gImmApiEntries.pImmGetDefaultIMEWnd) gImmApiEntries.pImmGetDefaultIMEWnd = IMM_ImmGetDefaultIMEWnd; gImmApiEntries.pImmNotifyIME = (BOOL (WINAPI*)(HIMC, DWORD, DWORD, DWORD)) GetProcAddress(imm32, "ImmNotifyIME");//.........这里部分代码省略.........
开发者ID:Moteesh,项目名称:reactos,代码行数:101,
示例14: DllRegisterServer//------------------------------------------------------------------------------// DllRegisterServer//------------------------------------------------------------------------------STDAPI DllRegisterServer(){ HKEY hKey = NULL; HMODULE hModule = NULL; HRESULT hr = S_OK; LONG lResult = ERROR_SUCCESS; WCHAR szFilename[MAX_PATH] = { 0 }; WCHAR szKey[MAX_PATH] = { 0 }; WCHAR szCLSID[OLEGUID_LEN_CCH] = { 0 }; // // Grab the fully qualified path to this dll // hModule = GetModuleHandleW(L"PrinterServiceFuncDiscovery"); if (NULL == hModule) { hr = HRESULT_FROM_WIN32(GetLastError()); } else if (0 == GetModuleFileNameW(hModule, szFilename, ARRAYSIZE(szFilename))) { hr = HRESULT_FROM_WIN32(GetLastError()); } // // Register the COM object in the registry // if (S_OK == hr && 0 == StringFromGUID2(CLSID_SsysPrinterSvcProxy, szCLSID, ARRAYSIZE(szCLSID))) { hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); } if (S_OK == hr) { hr = StringCchPrintfW(szKey, ARRAYSIZE(szKey), L"CLSID//%s", szCLSID); } if (S_OK == hr) { lResult = RegCreateKeyExW( HKEY_CLASSES_ROOT, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, NULL ); hr = HRESULT_FROM_WIN32(lResult); } if (S_OK == hr) { lResult = RegSetValueExW( hKey, NULL, 0, REG_SZ, (BYTE*)OBJECT_NAME, (static_cast<DWORD>(wcslen(OBJECT_NAME)) + 1)*sizeof(WCHAR) ); hr = HRESULT_FROM_WIN32(lResult); } RegCloseKey(hKey); if (S_OK == hr) { hr = StringCchPrintfW( szKey, ARRAYSIZE(szKey), L"CLSID//%s//InProcServer32", szCLSID ); } if (S_OK == hr) { lResult = RegCreateKeyExW( HKEY_CLASSES_ROOT, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, NULL ); hr = HRESULT_FROM_WIN32(lResult); } if (S_OK == hr) { lResult = RegSetValueExW( hKey,//.........这里部分代码省略.........
开发者ID:felihea,项目名称:stratasys,代码行数:101,
示例15: _glfwUnregisterWindowClass// Unregisters the GLFW window class//void _glfwUnregisterWindowClass(void){ UnregisterClassW(_GLFW_WNDCLASSNAME, GetModuleHandleW(NULL));}
开发者ID:netcrack,项目名称:glfw,代码行数:6,
示例16: Create void Create() { if ( ActivationCtxHandle != INVALID_HANDLE_VALUE ) { return ; } HMODULE hKernel = GetModuleHandleW( L"KERNEL32" ); if ( GetProcAddress( hKernel, "CreateActCtxW" ) == NULL ) { // Pre XP OS return; } bool ManifestInFile = false; System::Reflection::Assembly^ CurrentAssembly = System::Reflection::Assembly::GetCallingAssembly(); String^ AssemblyPath = CurrentAssembly->Location; try { if ( AssemblyPath == "" ) { String^ TempPath = System::IO::Path::GetTempFileName(); System::IO::StreamWriter^ sw = System::IO::File::CreateText(TempPath); sw->Write ( "<?xml version=/"1.0/" encoding=/"UTF-8/" standalone=/"yes/"?>/n" "<assembly xmlns=/"urn:schemas-microsoft-com:asm.v1/" manifestVersion=/"1.0/">/n" " <dependency>/n" " <dependentAssembly>/n" " <assemblyIdentity/n" " type='win32'/n"#ifdef _DEBUG " name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugCRT'/n"#else /* _DEBUG */ " name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT'/n"#endif /* _DEBUG */ " version='" _CRT_ASSEMBLY_VERSION "'/n"#ifdef _M_IX86 " processorArchitecture='x86'/n"#endif /* _M_IX86 */#ifdef _M_AMD64 " processorArchitecture='amd64'/n"#endif /* _M_AMD64 */#ifdef _M_IA64 " processorArchitecture='ia64'/n"#endif /* _M_IA64 */ " publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'/>/n" " </dependentAssembly>/n" " </dependency>/n" "</assembly>/n" ); sw->Close(); ManifestInFile = true; AssemblyPath = TempPath; } cli::pin_ptr<const System::Char> pAssemblyPath = PtrToStringChars(AssemblyPath); ACTCTXW actctx; // Don't call memset. memset results in a call to msvcr*.dll which can be loaded from WinSXS // only after the activation context is activated. actctx.wProcessorArchitecture = 0; actctx.wLangId = 0; actctx.lpAssemblyDirectory = NULL; actctx.lpApplicationName = NULL; actctx.hModule = NULL; actctx.cbSize = sizeof( actctx ); actctx.lpSource = pAssemblyPath; if (ManifestInFile) { actctx.lpResourceName = 0; actctx.dwFlags = 0; } else { actctx.lpResourceName = MAKEINTRESOURCEW( 2 ); actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; } ActivationCtxHandle = CreateActCtxW( &actctx ); if ( ActivationCtxHandle == INVALID_HANDLE_VALUE ) { if (!ManifestInFile) { actctx.lpResourceName = MAKEINTRESOURCEW( 1 ); ActivationCtxHandle = CreateActCtxW( &actctx ); } if ( ActivationCtxHandle == INVALID_HANDLE_VALUE ) { } } } finally { if (ManifestInFile) { System::IO::File::Delete(AssemblyPath); } }//.........这里部分代码省略.........
开发者ID:jetlive,项目名称:skiaming,代码行数:101,
示例17: LoadPluginsBOOL FASTCALL LoadPlugins(PVOID Param1, PVOID Param2, PVOID Param3){ BOOL Result; HMODULE hModule; // ensure edi is not modified Result = OldLoadPlugins(Param1, Param2, Param3); if (!Result) return Result; hModule = GetModuleHandleW(L"DLL//Sys43VM.dll"); if (hModule != NULL) FreeLibrary(hModule); hModule = LoadLibraryExW(L"DLL//Sys43VM.dll", NULL, 0); if (hModule != NULL) { INTEL_STATIC MEMORY_PATCH p[] = { { 0xEB, 1, 0x064EF }, { 0xEB, 1, 0x1C74E }, { 0xEB, 1, 0x1F35B }, { 0xEB, 1, 0x223B7 }, { 0xEB, 1, 0x229C4 }, { 0xEB, 1, 0x31DA8 }, { 0xEB, 1, 0x35C72 }, { 0xEB, 1, 0x35E09 }, { 0xEB, 1, 0x36491 }, { 0xEB, 1, 0x365D9 }, { 0xEB, 1, 0x36A81 }, { 0xEB, 1, 0x36BB9 }, { 0xEB, 1, 0x36F5F }, }; PatchMemory(p, countof(p), 0, 0, hModule); } hModule = GetModuleHandleW(L"ChipmunkSpriteEngine.dll"); if (hModule != NULL) { INTEL_STATIC MEMORY_PATCH p[] = { { 0xEB, 1, 0x02899 }, { 0xEB, 1, 0xA3ED7 }, { 0xEB, 1, 0xA81E6 }, }; INTEL_STATIC MEMORY_FUNCTION_PATCH f[] = { { JUMP, 0xEE00, GetCharOutline, 2, OldGetCharOutline }, { JUMP, 0xF050, GetCharBitsPerRow, 0, OldGetCharBitsOfRow }, { JUMP, 0xEFE4, GetCharDescent, 1, OldGetCharDescent }, }; PatchMemory(p, countof(p), f, countof(f), hModule); g_pfChipSpriteEngAllocMemory = (PVOID)(pfChipSpriteEngAllocMemory_RVA + (ULONG_PTR)hModule); } hModule = GetModuleHandleW(L"CrayfishLogViewer.dll"); if (hModule != NULL) { INTEL_STATIC MEMORY_PATCH p[] = { { 0xEB, 1, 0x02833 }, { 0xEB, 1, 0x04F3A }, }; PatchMemory(p, countof(p), 0, 0, hModule); } hModule = GetModuleHandleW(L"FileOperation.dll"); if (hModule != NULL) { INTEL_STATIC MEMORY_PATCH p[] = { { 0xEB, 1, 0x0DFC4 }, { 0xEB, 1, 0x0E199 }, }; PatchMemory(p, countof(p), 0, 0, hModule); } hModule = GetModuleHandleW(L"GoatGUIEngine.dll"); if (hModule != NULL) { INTEL_STATIC MEMORY_PATCH p[] = { { 0xEB, 1, 0x1BBE8 }, { 0xEB, 1, 0x1D5D0 }, { 0xEB, 1, 0x1E98C }, { 0xEB, 1, 0x1E9DF }, { 0xEB, 1, 0x1EA18 }, { 0xEB, 1, 0x1EB0C }, { 0xEB, 1, 0x1EB71 }, { 0xEB, 1, 0x20DCE }, }; PatchMemory(p, countof(p), 0, 0, hModule); } hModule = GetModuleHandleW(L"SystemService.dll"); if (hModule != NULL) {//.........这里部分代码省略.........
开发者ID:AyanamiRei,项目名称:chinesize,代码行数:101,
示例18: IntegrityCheckModulebool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModuleMac, SecByteBlock *pActualMac, unsigned long *pMacFileLocation){ std::auto_ptr<MessageAuthenticationCode> mac(NewIntegrityCheckingMAC()); unsigned int macSize = mac->DigestSize(); SecByteBlock tempMac; SecByteBlock &actualMac = pActualMac ? *pActualMac : tempMac; actualMac.resize(macSize); unsigned long tempLocation; unsigned long &macFileLocation = pMacFileLocation ? *pMacFileLocation : tempLocation; macFileLocation = 0; MeterFilter verifier(new HashFilter(*mac, new ArraySink(actualMac, actualMac.size())));// MeterFilter verifier(new FileSink("c://dt.tmp")); std::ifstream moduleStream;#ifdef CRYPTOPP_WIN32_AVAILABLE HMODULE h; { char moduleFilenameBuf[MAX_PATH] = ""; if (moduleFilename == NULL) {#if (_MSC_VER >= 1400 && !defined(_STLPORT_VERSION)) // ifstream doesn't support wide filename on other compilers wchar_t wideModuleFilename[MAX_PATH]; if (GetModuleFileNameW(s_hModule, wideModuleFilename, MAX_PATH) > 0) { moduleStream.open(wideModuleFilename, std::ios::in | std::ios::binary); h = GetModuleHandleW(wideModuleFilename); } else#endif { GetModuleFileNameA(s_hModule, moduleFilenameBuf, MAX_PATH); moduleFilename = moduleFilenameBuf; } }#endif if (moduleFilename != NULL) { moduleStream.open(moduleFilename, std::ios::in | std::ios::binary);#ifdef CRYPTOPP_WIN32_AVAILABLE h = GetModuleHandleA(moduleFilename); moduleFilename = NULL; }#endif } if (!moduleStream) {#ifdef CRYPTOPP_WIN32_AVAILABLE OutputDebugString("Crypto++ DLL integrity check failed. Cannot open file for reading.");#endif return false; } FileStore file(moduleStream);#ifdef CRYPTOPP_WIN32_AVAILABLE // try to hash from memory first const byte *memBase = (const byte *)h; const IMAGE_DOS_HEADER *ph = (IMAGE_DOS_HEADER *)memBase; const IMAGE_NT_HEADERS *phnt = (IMAGE_NT_HEADERS *)(memBase + ph->e_lfanew); const IMAGE_SECTION_HEADER *phs = IMAGE_FIRST_SECTION(phnt); DWORD nSections = phnt->FileHeader.NumberOfSections; size_t currentFilePos = 0; size_t checksumPos = (byte *)&phnt->OptionalHeader.CheckSum - memBase; size_t checksumSize = sizeof(phnt->OptionalHeader.CheckSum); size_t certificateTableDirectoryPos = (byte *)&phnt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY] - memBase; size_t certificateTableDirectorySize = sizeof(phnt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY]); size_t certificateTablePos = phnt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress; size_t certificateTableSize = phnt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY].Size; verifier.AddRangeToSkip(0, checksumPos, checksumSize); verifier.AddRangeToSkip(0, certificateTableDirectoryPos, certificateTableDirectorySize); verifier.AddRangeToSkip(0, certificateTablePos, certificateTableSize); while (nSections--) { switch (phs->Characteristics) { default: break; case IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ: case IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ: unsigned int sectionSize = STDMIN(phs->SizeOfRawData, phs->Misc.VirtualSize); const byte *sectionMemStart = memBase + phs->VirtualAddress; unsigned int sectionFileStart = phs->PointerToRawData; size_t subSectionStart = 0, nextSubSectionStart; do { const byte *subSectionMemStart = sectionMemStart + subSectionStart; size_t subSectionFileStart = sectionFileStart + subSectionStart; size_t subSectionSize = sectionSize - subSectionStart; nextSubSectionStart = 0; unsigned int entriesToReadFromDisk[] = {IMAGE_DIRECTORY_ENTRY_IMPORT, IMAGE_DIRECTORY_ENTRY_IAT}; for (unsigned int i=0; i<sizeof(entriesToReadFromDisk)/sizeof(entriesToReadFromDisk[0]); i++) {//.........这里部分代码省略.........
开发者ID:Dangr8,项目名称:Cities3D,代码行数:101,
示例19: wcsrchr/*--------------------------------------------------------------------------*/char *getScilabDirectory(BOOL UnixStyle){ char *SciPathName = NULL; wchar_t* wcSciPathName = NULL; wchar_t ScilabModuleName[MAX_PATH + 1]; wchar_t drive[_MAX_DRIVE]; wchar_t dir[_MAX_DIR]; wchar_t fname[_MAX_FNAME]; wchar_t ext[_MAX_EXT]; wchar_t *DirTmp = NULL; if (!GetModuleFileNameW ((HINSTANCE)GetModuleHandleW(L"core"), (wchar_t*) ScilabModuleName, MAX_PATH)) { return NULL; } os_wsplitpath(ScilabModuleName, drive, dir, fname, ext); if (dir[wcslen(dir) - 1] == L'//') { dir[wcslen(dir) - 1] = L'/0'; } DirTmp = wcsrchr (dir, L'//'); if (wcslen(dir) - wcslen(DirTmp) > 0) { dir[wcslen(dir) - wcslen(DirTmp)] = L'/0'; } else { return NULL; } wcSciPathName = (wchar_t*)MALLOC((int)( wcslen(drive) + wcslen(dir) + 5) * sizeof(wchar_t)); if (wcSciPathName) { _wmakepath(wcSciPathName, drive, dir, NULL, NULL); if ( UnixStyle ) { int i = 0; for (i = 0; i < (int)wcslen(wcSciPathName); i++) { if (wcSciPathName[i] == L'//') { wcSciPathName[i] = L'/'; } } } wcSciPathName[wcslen(wcSciPathName) - 1] = '/0'; SciPathName = wide_string_to_UTF8(wcSciPathName); FREE(wcSciPathName); wcSciPathName = NULL; } if (SciPathName) { setSCI(SciPathName); } return SciPathName;}
开发者ID:FOSSEE-Internship,项目名称:scilab,代码行数:65,
示例20: test_ime_processkeystatic void test_ime_processkey(void){ WCHAR classNameW[] = {'P','r','o','c','e','s','s', 'K','e','y','T','e','s','t','C','l','a','s','s',0}; WCHAR windowNameW[] = {'P','r','o','c','e','s','s', 'K','e','y',0}; MSG msg; WNDCLASSW wclass; HANDLE hInstance = GetModuleHandleW(NULL); TEST_INPUT inputs[2]; HIMC imc; INT rc; HWND hWndTest; wclass.lpszClassName = classNameW; wclass.style = CS_HREDRAW | CS_VREDRAW; wclass.lpfnWndProc = processkey_wnd_proc; wclass.hInstance = hInstance; wclass.hIcon = LoadIcon(0, IDI_APPLICATION); wclass.hCursor = LoadCursor( NULL, IDC_ARROW); wclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wclass.lpszMenuName = 0; wclass.cbClsExtra = 0; wclass.cbWndExtra = 0; if(!RegisterClassW(&wclass)){ win_skip("Failed to register window./n"); return; } /* create the test window that will receive the keystrokes */ hWndTest = CreateWindowW(wclass.lpszClassName, windowNameW, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 100, 100, NULL, NULL, hInstance, NULL); ShowWindow(hWndTest, SW_SHOW); SetWindowPos(hWndTest, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE); SetForegroundWindow(hWndTest); UpdateWindow(hWndTest); imc = ImmGetContext(hWndTest); if (!imc) { win_skip("IME not supported/n"); DestroyWindow(hWndTest); return; } rc = ImmSetOpenStatus(imc, TRUE); if (rc != TRUE) { win_skip("Unable to open IME/n"); ImmReleaseContext(hWndTest, imc); DestroyWindow(hWndTest); return; } /* flush pending messages */ while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageW(&msg); SetFocus(hWndTest); /* init input data that never changes */ inputs[1].type = inputs[0].type = INPUT_KEYBOARD; inputs[1].u.ki.dwExtraInfo = inputs[0].u.ki.dwExtraInfo = 0; inputs[1].u.ki.time = inputs[0].u.ki.time = 0; /* Pressing a key */ inputs[0].u.ki.wVk = 0x41; inputs[0].u.ki.wScan = 0x1e; inputs[0].u.ki.dwFlags = 0x0; pSendInput(1, (INPUT*)inputs, sizeof(INPUT)); while(PeekMessageW(&msg, hWndTest, 0, 0, PM_NOREMOVE)) { if(msg.message != WM_KEYDOWN) PeekMessageW(&msg, hWndTest, 0, 0, PM_REMOVE); else { ok(msg.wParam != VK_PROCESSKEY,"Incorrect ProcessKey Found/n"); PeekMessageW(&msg, hWndTest, 0, 0, PM_REMOVE); if(msg.wParam == VK_PROCESSKEY) trace("ProcessKey was correctly found/n"); } TranslateMessage(&msg); DispatchMessageW(&msg); } inputs[0].u.ki.wVk = 0x41; inputs[0].u.ki.wScan = 0x1e; inputs[0].u.ki.dwFlags = KEYEVENTF_KEYUP; pSendInput(1, (INPUT*)inputs, sizeof(INPUT)); while(PeekMessageW(&msg, hWndTest, 0, 0, PM_NOREMOVE)) { if(msg.message != WM_KEYUP) PeekMessageW(&msg, hWndTest, 0, 0, PM_REMOVE); else { ok(msg.wParam != VK_PROCESSKEY,"Incorrect ProcessKey Found/n"); PeekMessageW(&msg, hWndTest, 0, 0, PM_REMOVE); ok(msg.wParam != VK_PROCESSKEY,"ProcessKey should still not be Found/n");//.........这里部分代码省略.........
开发者ID:krofna,项目名称:wine,代码行数:101,
示例21: _WCHstaticRU32 installService ( ){ HMODULE hModule = NULL; RWCHAR curPath[ RPAL_MAX_PATH ] = { 0 }; RWCHAR destPath[] = _WCH( "%SYSTEMROOT%//system32//rphcp.exe" ); RWCHAR svcPath[] = _WCH( "/"%SYSTEMROOT%//system32//rphcp.exe/" -w" ); SC_HANDLE hScm = NULL; SC_HANDLE hSvc = NULL; RWCHAR svcName[] = { _SERVICE_NAMEW }; RWCHAR svcDisplay[] = { _WCH( "rp_HCP_Svc" ) }; rpal_debug_info( "installing service" ); hModule = GetModuleHandleW( NULL ); if( NULL != hModule ) { if( ARRAY_N_ELEM( curPath ) > GetModuleFileNameW( hModule, curPath, ARRAY_N_ELEM( curPath ) ) ) { if( rpal_file_copy( curPath, destPath ) ) { if( NULL != ( hScm = OpenSCManagerA( NULL, NULL, SC_MANAGER_CREATE_SERVICE ) ) ) { if( NULL != ( hSvc = CreateServiceW( hScm, svcName, svcDisplay, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, svcPath, NULL, NULL, NULL, NULL, _WCH( "" ) ) ) ) { if( StartService( hSvc, 0, NULL ) ) { // Emitting as error level to make sure it's displayed in release. rpal_debug_error( "service installer!" ); return 0; } else { rpal_debug_error( "could not start service: %d", GetLastError() ); } CloseServiceHandle( hSvc ); } else { rpal_debug_error( "could not create service in SCM: %d", GetLastError() ); } CloseServiceHandle( hScm ); } else { rpal_debug_error( "could not open SCM: %d", GetLastError() ); } } else { rpal_debug_error( "could not move executable to service location: %d", GetLastError() ); } } else { rpal_debug_error( "could not get current executable path: %d", GetLastError() ); } CloseHandle( hModule ); } else { rpal_debug_error( "could not get current executable handle: %d", GetLastError() ); } return GetLastError();}
开发者ID:sun123qiang123,项目名称:limacharlie,代码行数:85,
示例22: GPHOTO2_OpenDSstatic TW_UINT16GPHOTO2_OpenDS( pTW_IDENTITY pOrigin, pTW_IDENTITY self) { int ret, m, p, count, i; CameraAbilities a; GPPortInfo info; const char *model, *port; if (GPHOTO2_dsmentry == NULL) { static const WCHAR twain32W[] = {'t','w','a','i','n','_','3','2',0}; HMODULE moddsm = GetModuleHandleW(twain32W); if (moddsm) GPHOTO2_dsmentry = (void*)GetProcAddress(moddsm, "DSM_Entry"); if (!GPHOTO2_dsmentry) { ERR("can't find DSM entry point/n"); return TWRC_FAILURE; } } if (TWRC_SUCCESS != gphoto2_auto_detect()) return TWRC_FAILURE; if (lstrcmpA(self->ProductFamily,"GPhoto2 Camera")) { FIXME("identity passed is not a gphoto camera, but %s!?!/n", self->ProductFamily); return TWRC_FAILURE; } count = gp_list_count (detected_cameras); if (!count) { ERR("No camera found by autodetection. Returning failure./n"); return TWRC_FAILURE; } if (!lstrcmpA (self->ProductName, "GPhoto2 Camera")) { TRACE("Potential undetected camera. Just using the first autodetected one./n"); i = 0; } else { for (i=0;i<count;i++) { const char *cname, *pname; TW_STR32 name; gp_list_get_name (detected_cameras, i, &cname); gp_list_get_value (detected_cameras, i, &pname); if (!lstrcmpA(self->ProductName,cname)) break; snprintf(name, sizeof(name), "%s", cname); if (!lstrcmpA(self->ProductName,name)) break; snprintf(name, sizeof(name), "%[email C++ GetModuleInformation函数代码示例 C++ GetModuleHandleEx函数代码示例
|