René's URL Explorer Experiment


Title: Create Activation Context Implementation (with code) · Issue #100 · fancycode/MemoryModule · GitHub

Open Graph Title: Create Activation Context Implementation (with code) · Issue #100 · fancycode/MemoryModule

X Title: Create Activation Context Implementation (with code) · Issue #100 · fancycode/MemoryModule

Description: Whenever you load a DLL or start an EXE which has a manifest you should create an AcrivationContext before loading any dependent libraries (before calling BuildImportTable()) This is required when any of the imported libraries exists in ...

Open Graph Description: Whenever you load a DLL or start an EXE which has a manifest you should create an AcrivationContext before loading any dependent libraries (before calling BuildImportTable()) This is required when ...

X Description: Whenever you load a DLL or start an EXE which has a manifest you should create an AcrivationContext before loading any dependent libraries (before calling BuildImportTable()) This is required when ...

Opengraph URL: https://github.com/fancycode/MemoryModule/issues/100

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Create Activation Context Implementation (with code)","articleBody":"Whenever you load a DLL or start an EXE which has a manifest you should create an AcrivationContext before loading any dependent libraries (before calling BuildImportTable())\r\n\r\nThis is required when any of the imported libraries exists in multiple versions in the SXS Side-by-Side store of Windows.\r\nThe ActivationContext is required to tell Windows for example which version of COMCTL32.dll or MSVCR80.dll has to be loaded.\r\n\r\nI made lots of changes in the original code. Therefore I don't make a pull request now.\r\nApart from that Joachim Bauch does not merge pull requests anymore. He does not even answer emails.\r\n\r\nSo here is my code:\r\n\r\n```\r\n// Required for all DLL's and EXE's which load dependent SXS DLL's like COMCTL32.dll or MSVCR80.dll\r\n// Returns API error\r\nDWORD cMemMod::CreateActivationContext(PMEMORYMODULE module, HANDLE* ph_ActCtx, ULONG_PTR* pu32_ActCtxCookie)\r\n{\r\n    DWORD u32_Error = 0;\r\n\r\n    LPCWSTR u16_Manifest = module-\u003eisDLL ? ISOLATIONAWARE_MANIFEST_RESOURCE_ID : CREATEPROCESS_MANIFEST_RESOURCE_ID;\r\n    HRSRC   h_Resource   = FindResource((HMODULE)module-\u003ecodeBase, u16_Manifest, RT_MANIFEST);\r\n    if (!h_Resource)\r\n        return 0; // The EXE / DLL has no manifest\r\n\r\n    BYTE* u8_MemPtr = (BYTE*)LoadResource  ((HMODULE)module-\u003ecodeBase, h_Resource);\r\n    DWORD u32_Size  =        SizeofResource((HMODULE)module-\u003ecodeBase, h_Resource);\r\n\r\n    WCHAR u16_TempPath[MAX_PATH];\r\n    GetTempPath(MAX_PATH, u16_TempPath); // terminated with backslash\r\n\r\n    // Create a random temporary file name\r\n    WCHAR u16_TmpFile[MAX_PATH];\r\n    swprintf(u16_TmpFile, L\"%sDLL%X.manifest\", u16_TempPath, (DWORD)__rdtsc());\r\n    \r\n    HANDLE h_File = CreateFileW(u16_TmpFile, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, 0);\r\n    if (h_File == INVALID_HANDLE_VALUE)\r\n        return GetLastError();\r\n\r\n    DWORD u32_Written;\r\n    if (!WriteFile(h_File, u8_MemPtr, u32_Size, \u0026u32_Written, 0))\r\n        u32_Error = GetLastError();\r\n\r\n    CloseHandle(h_File);\r\n\r\n    if (u32_Error)\r\n        return u32_Error;\r\n\r\n    // Getting a manifest from memory does not work.\r\n    // Even with Flags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID --\u003e Windows searches for the *.DLL file \r\n    // and for the *.MANIFEST file specified in lpSource on disk.\r\n    // If lpSource == NULL --\u003e ERROR_MOD_NOT_FOUND. On Windows XP bug --\u003e ERROR_NOT_ENOUGH_MEMORY\r\n    ACTCTXW k_Ctx  = {0};\r\n    k_Ctx.cbSize   = sizeof(k_Ctx);\r\n    k_Ctx.lpSource = u16_TmpFile; \r\n\r\n    *ph_ActCtx = CreateActCtxW(\u0026k_Ctx);\r\n    u32_Error  = GetLastError();\r\n\r\n    DeleteFile(u16_TmpFile);\r\n\r\n    if (*ph_ActCtx == INVALID_HANDLE_VALUE)\r\n        return u32_Error;\r\n    \r\n    if (!ActivateActCtx(*ph_ActCtx, pu32_ActCtxCookie))\r\n        return GetLastError();\r\n\r\n    TRACE(L\"\u003e\u003e Activate ActCtx: %p\", *ph_ActCtx);\r\n    return 0;\r\n}\r\n```\r\n\r\nYou must call this function before calling BuildImportTable().\r\n\r\n```\r\n    HANDLE    h_ActContext     = NULL;\r\n    ULONG_PTR u32_ActCtxCookie = 0;\r\n\r\n    // Create Activation Context (and activate) before loading dependent modules\r\n    if (u32_Error = CreateActivationContext(pi_ModData, \u0026h_ActContext, \u0026u32_ActCtxCookie))\r\n        goto error;\r\n\r\n```\r\n\r\nAfter calling the entry point of the DLL you don't need the activation context anymore.\r\n\r\n```\r\n    if (h_ActContext)\r\n    {\r\n        TRACE(L\"\u003c\u003c Deactivate ActCtx\");\r\n\r\n        if (u32_ActCtxCookie)\r\n            DeactivateActCtx(0, u32_ActCtxCookie); \r\n            \r\n        ReleaseActCtx(h_ActContext);\r\n    }\r\n\r\n```\r\n","author":{"url":"https://github.com/Elmue","@type":"Person","name":"Elmue"},"datePublished":"2020-07-02T16:35:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/100/MemoryModule/issues/100"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:deec127c-6e7d-ca35-67c5-92a8cfbfaa4e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB7DE:273B14:7442DA:A15F23:696F3A58
html-safe-nonceac55bf727137966713c19569609e85cdcea532d269344127b2ef075285db19d4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0RFOjI3M0IxNDo3NDQyREE6QTE1RjIzOjY5NkYzQTU4IiwidmlzaXRvcl9pZCI6IjI3NTQ2NzI1NTIzMTgwMjQyODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacec56a46a47840880a4ac78cca69d86d8d2fa535862310f5abd5200b52b01d5a4
hovercard-subject-tagissue:650066671
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/fancycode/MemoryModule/100/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e7144874eb0af0faa253d34c2ad4efe2910c501ed892fa4b22cb4d092891989d/fancycode/MemoryModule/issues/100
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e7144874eb0af0faa253d34c2ad4efe2910c501ed892fa4b22cb4d092891989d/fancycode/MemoryModule/issues/100
og:image:altWhenever you load a DLL or start an EXE which has a manifest you should create an AcrivationContext before loading any dependent libraries (before calling BuildImportTable()) This is required when ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameElmue
hostnamegithub.com
expected-hostnamegithub.com
Noneb278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee
turbo-cache-controlno-preview
go-importgithub.com/fancycode/MemoryModule git https://github.com/fancycode/MemoryModule.git
octolytics-dimension-user_id247730
octolytics-dimension-user_loginfancycode
octolytics-dimension-repository_id1018522
octolytics-dimension-repository_nwofancycode/MemoryModule
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1018522
octolytics-dimension-repository_network_root_nwofancycode/MemoryModule
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release39aed5006635ab6f45e6b77d23e73b08a00272a3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/fancycode/MemoryModule/issues/100#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffancycode%2FMemoryModule%2Fissues%2F100
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffancycode%2FMemoryModule%2Fissues%2F100
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=fancycode%2FMemoryModule
Reloadhttps://github.com/fancycode/MemoryModule/issues/100
Reloadhttps://github.com/fancycode/MemoryModule/issues/100
Reloadhttps://github.com/fancycode/MemoryModule/issues/100
fancycode https://github.com/fancycode
MemoryModulehttps://github.com/fancycode/MemoryModule
Notifications https://github.com/login?return_to=%2Ffancycode%2FMemoryModule
Fork 806 https://github.com/login?return_to=%2Ffancycode%2FMemoryModule
Star 3.1k https://github.com/login?return_to=%2Ffancycode%2FMemoryModule
Code https://github.com/fancycode/MemoryModule
Issues 48 https://github.com/fancycode/MemoryModule/issues
Pull requests 9 https://github.com/fancycode/MemoryModule/pulls
Actions https://github.com/fancycode/MemoryModule/actions
Projects 0 https://github.com/fancycode/MemoryModule/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/fancycode/MemoryModule/security
Please reload this pagehttps://github.com/fancycode/MemoryModule/issues/100
Insights https://github.com/fancycode/MemoryModule/pulse
Code https://github.com/fancycode/MemoryModule
Issues https://github.com/fancycode/MemoryModule/issues
Pull requests https://github.com/fancycode/MemoryModule/pulls
Actions https://github.com/fancycode/MemoryModule/actions
Projects https://github.com/fancycode/MemoryModule/projects
Security https://github.com/fancycode/MemoryModule/security
Insights https://github.com/fancycode/MemoryModule/pulse
New issuehttps://github.com/login?return_to=https://github.com/fancycode/MemoryModule/issues/100
New issuehttps://github.com/login?return_to=https://github.com/fancycode/MemoryModule/issues/100
Create Activation Context Implementation (with code)https://github.com/fancycode/MemoryModule/issues/100#top
https://github.com/Elmue
https://github.com/Elmue
Elmuehttps://github.com/Elmue
on Jul 2, 2020https://github.com/fancycode/MemoryModule/issues/100#issue-650066671
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.