extern "C" HRESULT CALLBACK DebugExtensionInitialize(PULONG Version, PULONG Flags) { *Version = DEBUG_EXTENSION_VERSION(1, 0); *Flags = 0; return S_OK; }
HRESULT CALLBACK DebugExtensionInitialize(PULONG Version, PULONG Flags) { IDebugClient *DebugClient = NULL; HRESULT Hr= S_OK; *Version = DEBUG_EXTENSION_VERSION(1, 0); *Flags = 0; // Connect to client if ((Hr = DebugCreate(__uuidof(IDebugClient), (void **)&DebugClient)) != S_OK) { return Hr; } // Get the windbg-style extension APIS PDEBUG_CONTROL DebugControl; if ((Hr = DebugClient->QueryInterface(__uuidof(IDebugControl), (void **)&DebugControl)) == S_OK) { ExtensionApis.nSize = sizeof (ExtensionApis); Hr = DebugControl->GetWindbgExtensionApis64(&ExtensionApis); DebugControl->Release(); } // done DebugClient->Release(); return Hr; }
HRESULT ExtensionContext::initialize(PULONG Version, PULONG Flags) { if (isInitialized()) return S_OK; *Version = DEBUG_EXTENSION_VERSION(1, 0); *Flags = 0; IInterfacePointer<CIDebugClient> client; if (!client.create()) return client.hr(); m_control.create(client.data()); if (!m_control) return m_control.hr(); return m_control->GetWindbgExtensionApis64(&ExtensionApis); }
HRESULT CALLBACK DebugExtensionInitialize(PULONG Version, PULONG Flags) { HRESULT hRes=S_OK; IDebugClient *DebugClient; PDEBUG_CONTROL DebugControl; *Version = DEBUG_EXTENSION_VERSION(EXT_MAJOR_VER, EXT_MINOR_VER); *Flags = 0; if (FAILED(hRes=DebugCreate(__uuidof(IDebugClient), (void **)&DebugClient))) return hRes; if (SUCCEEDED(hRes=DebugClient->QueryInterface(__uuidof(IDebugControl), (void **)&DebugControl))) { // Get the windbg-style extension APIS ExtensionApis.nSize = sizeof (ExtensionApis); hRes = DebugControl->GetWindbgExtensionApis64(&ExtensionApis); DebugControl->Release(); dprintf("[sync] DebugExtensionInitialize, ExtensionApis loaded\n"); } DebugClient->Release(); g_ExtClient = NULL; g_Synchronized = FALSE; g_hPollCompleteEvent = CreateEvent(NULL, true, false, NULL); if (g_hPollCompleteEvent == NULL) { dprintf("[sync] Command polling feature init failed\n"); return E_FAIL; } InitializeCriticalSection(&g_CritSectPollRelease); if(SUCCEEDED(LoadConfigurationFile())) dprintf("[sync] Configuration file loaded\n -> set HOST to %s:%s\n", g_DefaultHost, g_DefaultPort); return hRes; }
//jc: this in the init routine. Runs on load. HRESULT CALLBACK DebugExtensionInitialize(PULONG Version, PULONG Flags) { IDebugClient *DebugClient; PDEBUG_CONTROL DebugControl; HRESULT Hr; *Version = DEBUG_EXTENSION_VERSION(1, 0); *Flags = 0; Hr = S_OK; if ((Hr = DebugCreate(__uuidof(IDebugClient), (void **)&DebugClient)) != S_OK) { return Hr; } if ((Hr = DebugClient->QueryInterface(__uuidof(IDebugControl), (void **)&DebugControl)) == S_OK) { // // Get the windbg-style extension APIS // ExtensionApis.nSize = sizeof (ExtensionApis); Hr = DebugControl->GetWindbgExtensionApis64(&ExtensionApis); DebugControl->Release(); } dprintf("[Byakugan] Successfully loaded!\n"); DebugClient->Release(); return (Hr); }
extern "C" HRESULT CALLBACK DebugExtensionInitialize(PULONG Version, PULONG Flags) { IDebugClient *DebugClient; PDEBUG_CONTROL DebugControl; HRESULT Hr; *Version = DEBUG_EXTENSION_VERSION(1, 0); *Flags = 0; Hr = S_OK; if ((Hr = DebugCreate(__uuidof(IDebugClient), (void **)&DebugClient)) != S_OK) { return Hr; } if ((Hr = DebugClient->QueryInterface(__uuidof(IDebugControl), (void **)&DebugControl)) == S_OK) { ExtensionApis.nSize = sizeof(ExtensionApis); Hr = DebugControl->GetWindbgExtensionApis64(&ExtensionApis); DebugControl->Release(); } DebugClient->Release(); return Hr; }
HRESULT CALLBACK DebugExtensionInitialize(PULONG Version, PULONG Flags) { IDebugClient *DebugClient; PDEBUG_CONTROL DebugControl; HRESULT Hr; *Version = DEBUG_EXTENSION_VERSION(1, 0); *Flags = 0; if (g_Initialized) { return S_OK; } g_Initialized = true; if ((Hr = DebugCreate(__uuidof(IDebugClient), (void **)&DebugClient)) != S_OK) { return Hr; } if ((Hr = DebugClient->QueryInterface(__uuidof(IDebugControl), (void **)&DebugControl)) != S_OK) { return Hr; } ExtensionApis.nSize = sizeof (ExtensionApis); if ((Hr = DebugControl->GetWindbgExtensionApis64(&ExtensionApis)) != S_OK) { return Hr; } // Fixes the "Unable to read dynamic function table entries" error messages by disabling the WinDbg security // feature that prevents the loading of unknown out of proc tack walkers. DebugControl->Execute(DEBUG_OUTCTL_IGNORE, ".settings set EngineInitialization.VerifyFunctionTableCallbacks=false", DEBUG_EXECUTE_NOT_LOGGED | DEBUG_EXECUTE_NO_REPEAT); ExtQuery(DebugClient); if (IsMiniDumpFileNODAC()) { ExtOut ( "----------------------------------------------------------------------------\n" "The user dump currently examined is a minidump. Consequently, only a subset\n" "of sos.dll functionality will be available. If needed, attaching to the live\n" "process or debugging a full dump will allow access to sos.dll's full feature\n" "set.\n" "To create a full user dump use the command: .dump /ma <filename>\n" "----------------------------------------------------------------------------\n"); } ExtRelease(); OnUnloadTask::Register(CleanupEventCallbacks); g_pCallbacksClient = DebugClient; EventCallbacks* pCallbacksObj = new EventCallbacks(DebugClient); IDebugEventCallbacks* pCallbacks = NULL; pCallbacksObj->QueryInterface(__uuidof(IDebugEventCallbacks), (void**)&pCallbacks); pCallbacksObj->Release(); if(FAILED(Hr = g_pCallbacksClient->SetEventCallbacks(pCallbacks))) { ExtOut ("SOS: Failed to register callback events\n"); pCallbacks->Release(); return Hr; } pCallbacks->Release(); #ifndef _ARM_ // Make sure we do not tear down the debugger when a security function fails // Since we link statically against CRT this will only affect the SOS module. _set_invalid_parameter_handler(_SOS_invalid_parameter); #endif DebugControl->Release(); return S_OK; }
extern "C" HRESULT CALLBACK DebugExtensionInitialize(PULONG Version, PULONG Flags) { HRESULT hRes=E_FAIL; if(bInitialized) { return S_OK; } // // Initialize the version information // *Version=DEBUG_EXTENSION_VERSION(1, 0); *Flags=0; // // Initialize required COM interface pointers // if(FAILED(hRes=DebugCreate(__uuidof(IDebugClient), (void**) &pDebugClient))) { return hRes; } if(FAILED(hRes=pDebugClient->QueryInterface(__uuidof(IDebugControl), (void**) &pDebugControl))) { ReleaseComPointers(); return hRes; } // // Initialize WinDbg extension data // ExtensionApis.nSize=sizeof(ExtensionApis); hRes=pDebugControl->GetWindbgExtensionApis64(&ExtensionApis); if(FAILED((hRes=pDebugClient->QueryInterface(__uuidof(IDebugDataSpaces), (void**) &pDataSpaces)))) { dprintf( "Failed to get required COM interface\n"); ReleaseComPointers(); return hRes; } if(FAILED(hRes=pDebugClient->QueryInterface(__uuidof(IDebugSymbols), (void**) &pSymbols))) { dprintf( "Failed to get required COM interface\n"); ReleaseComPointers(); return hRes; } if(FAILED(hRes=pDebugClient->QueryInterface(__uuidof(IDebugSymbols3), (void**) &pSymbols3))) { dprintf( "Failed to get required COM interface\n"); ReleaseComPointers(); return hRes; } // // Initialize type information // if(FAILED(hRes=pSymbols->GetModuleByModuleName("11bstree", 0, NULL, &pBase))) { dprintf("Failed to get module information for bstree.exe\n"); ReleaseComPointers(); return hRes; } if(FAILED(hRes=pSymbols3->GetTypeId(pBase, "CBinaryTree::_TreeNode", &pNodeIndex))) { dprintf("Failed to get type id\n"); ReleaseComPointers(); return hRes; } if(FAILED(hRes=pSymbols->GetTypeSize(pBase, pNodeIndex, &pSize))) { dprintf("Failed to get type size\n"); ReleaseComPointers(); return hRes; } if(FAILED(hRes=pSymbols->GetFieldOffset(pBase, pNodeIndex, "pLeftChild", &ulLeftOffset))) { dprintf("Failed to get left child offset\n"); ReleaseComPointers(); return hRes; } if(FAILED(hRes=pSymbols->GetFieldOffset(pBase, pNodeIndex, "pRightChild", &ulRightOffset))) { dprintf("Failed to get right child offset\n"); ReleaseComPointers(); return hRes; } if(FAILED(hRes=pSymbols->GetFieldOffset(pBase, pNodeIndex, "data", &ulDataOffset))) { dprintf("Failed to get data offset\n"); ReleaseComPointers(); return hRes; } bInitialized=TRUE; hRes=S_OK; return hRes; }