{"id":117,"date":"2008-03-25T16:16:21","date_gmt":"2008-03-25T10:46:21","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/register-dlls-elevated-using-the-context-menu\/"},"modified":"2019-07-04T15:05:28","modified_gmt":"2019-07-04T15:05:28","slug":"register-dlls-elevated-using-the-context-menu","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/register-dlls-elevated-using-the-context-menu\/","title":{"rendered":"Register and Unregister DLLs Elevated via Right-click Context Menu"},"content":{"rendered":"<p>This post tells you how to add register and unregister commands to the right-click menu for DLL and OCX files in Windows Vista, 7, 8 and 10.<\/p>\n<p>To register a DLL or OCX file, you usually need to run regsvr32.exe from an <b>elevated<\/b> Command Prompt. Registering system DLLs from a non-elevated state may cause an error. For example, try to register the system module <b>JScript.dll<\/b> from Start, Search box (i.e., without elevating it). You&#8217;ll see the error <b>0x80004005<\/b> or <b>0x80007005<\/b> (&#8220;ACCESS IS DENIED&#8221;) when you do so.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10175\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/03\/regsvr32-error-80004005.png\" alt=\"regsvr32 error 0x80004005\" width=\"413\" height=\"185\" \/><\/p>\n<p><!--more--><\/p>\n<h2>Method 1: Register DLLs via Context Menu &#8211; &#8220;runas&#8221; verb<\/h2>\n<p>To add the <b>Register<\/b> command in the context menu that&#8217;ll run the <strong>Regsvr32.exe<\/strong> command under elevated rights, you can use the special <b>runas<\/b> verb. Here is a REG file that I created, adds the runas verb for DLL and OCX file types in the following registry keys:<\/p>\n<pre>HKEY_CLASSES_ROOT\\dllfile\\runas\r\nHKEY_CLASSES_ROOT\\ocxfile\\runas<\/pre>\n<ol>\n<li>Download the file <strong><a href=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/03\/register_runas.zip\">register_runas.reg<\/a><\/strong> and save to Desktop.<\/li>\n<li>Right-click on the file and choose Merge.<\/li>\n<li>Click <b>Yes<\/b> when you&#8217;re asked for confirmation.<\/li>\n<\/ol>\n<p>You should now see the <b>Register (as Administrator)<\/b> command in the right-click menu for DLL and OCX file types.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4070\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/03\/register-context.png\" alt=\"register dll context menu regsvr32\" width=\"300\" height=\"111\" \/><\/p>\n<h2>Method 2: Set Regsvr32.exe to always run elevated<\/h2>\n<p>As you can use the &#8220;runas&#8221; verb for only one item, to add a &#8220;Unregister&#8221; command you need to use a different method than the above. Here is another way to add &#8220;Register&#8221; and &#8220;Unregister&#8221; commands to the context menu for DLL files, without using the &#8220;runas&#8221; verb.<\/p>\n<p>This method instructs the system to always run Regsvr32.exe elevated, by adding a <code>AppCompatFlags\\Layers<\/code> registry entry, and implements the &#8220;Register&#8221; and &#8220;Unregister&#8221; context menu entries in the usual way.<\/p>\n<h3><strong>REG File<\/strong><\/h3>\n<pre>Windows Registry Editor Version 5.00\r\n\r\n[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers]\r\n\"C:\\\\Windows\\\\System32\\\\regsvr32.exe\"=\"~ RUNASADMIN\"\r\n\r\n[HKEY_CLASSES_ROOT\\DllFile\\Shell\\Register]\r\n\"HasLUAShield\"=\"\"\r\n\r\n[HKEY_CLASSES_ROOT\\DllFile\\Shell\\Register\\command]\r\n@=\"C:\\\\Windows\\\\System32\\\\regsvr32.exe \\\"%1\\\"\"\r\n\r\n[HKEY_CLASSES_ROOT\\DllFile\\Shell\\Unregister]\r\n\"HasLUAShield\"=\"\"\r\n\r\n[HKEY_CLASSES_ROOT\\DllFile\\Shell\\Unregister\\command]\r\n@=\"C:\\\\Windows\\\\System32\\\\regsvr32.exe -u \\\"%1\\\"\"\r\n\r\n[HKEY_CLASSES_ROOT\\OcxFile\\Shell\\Register]\r\n\"HasLUAShield\"=\"\"\r\n\r\n[HKEY_CLASSES_ROOT\\OcxFile\\Shell\\Register\\command]\r\n@=\"C:\\\\Windows\\\\System32\\\\regsvr32.exe \\\"%1\\\"\"\r\n\r\n[HKEY_CLASSES_ROOT\\OcxFile\\Shell\\Unregister]\r\n\"HasLUAShield\"=\"\"\r\n\r\n[HKEY_CLASSES_ROOT\\OcxFile\\Shell\\Unregister\\command]\r\n@=\"C:\\\\Windows\\\\System32\\\\regsvr32.exe -u \\\"%1\\\"\"\r\n<\/pre>\n<p>Copy the above lines to Notepad, and save the file with .reg extension. Double-click to <a href=\"https:\/\/www.winhelponline.com\/blog\/how-to-use-reg-files-registration-entries-windows\/\">run the .reg file<\/a>. This adds the &#8220;Register&#8221; and &#8220;Unregister&#8221; commands to the context menu for DLL and OCX files.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4069\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/03\/register-dll-context-menu.png\" alt=\"register dll context menu regsvr32\" width=\"421\" height=\"464\" \/><\/p>\n<p>To remove (undo) the Register and Unregister commands from the context menu, use the following .reg file:<\/p>\n<pre>Windows Registry Editor Version 5.00\r\n\r\n[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers]\r\n\"C:\\\\Windows\\\\System32\\\\regsvr32.exe\"=-\r\n\r\n[-HKEY_CLASSES_ROOT\\DllFile\\Shell\\Register]\r\n\r\n[-HKEY_CLASSES_ROOT\\DllFile\\Shell\\Unregister]\r\n\r\n[-HKEY_CLASSES_ROOT\\OcxFile\\Shell\\Register]\r\n\r\n[-HKEY_CLASSES_ROOT\\OcxFile\\Shell\\Unregister]<\/pre>\n<p>That&#8217;s it!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post tells you how to add register and unregister commands to the right-click menu for DLL and OCX files in Windows Vista, 7, 8 and 10. To register a DLL or OCX file, you usually need to run regsvr32.exe from an elevated Command Prompt. Registering system DLLs from a non-elevated state may cause an &#8230; <a title=\"Register and Unregister DLLs Elevated via Right-click Context Menu\" class=\"read-more\" href=\"https:\/\/www.winhelponline.com\/blog\/register-dlls-elevated-using-the-context-menu\/\" aria-label=\"Read more about Register and Unregister DLLs Elevated via Right-click Context Menu\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[7],"tags":[441],"class_list":["post-117","post","type-post","status-publish","format-standard","hentry","category-windows","tag-registry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":123,"url":"https:\/\/www.winhelponline.com\/blog\/add-edit-hosts-file-option-in-the-context-menu\/","url_meta":{"origin":117,"position":0},"title":"Add &#8220;Edit HOSTS file&#8221; option in the context menu","author":"Ramesh","date":"March 26, 2008","format":false,"excerpt":"The HOSTS file, originally introduced to resolve hostnames to IP addresses, is also an effective tool to block Malware. To modify the HOSTS file in Windows, you need to elevate Notepad.exe or any other text editor which you use. Otherwise, you'll see the following error when trying to save the\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/hosts3.gif?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":25473,"url":"https:\/\/www.winhelponline.com\/blog\/comdlg32-ocx-missing-invalid-dependencies-not-registered\/","url_meta":{"origin":117,"position":1},"title":"COMDLG32.OCX Missing or Dependencies not Registered","author":"Ramesh","date":"January 3, 2022","format":false,"excerpt":"The comdlg32.ocx module is used by classic Visual Basic programs. This ActiveX control is responsible for the functionality of common dialog boxes in your VB application. Common dialog boxes include the Open and Save As file dialog boxes; the Find and Replace editing dialog boxes; the Print, Print Setup, Page\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"comdlg32.ocx error 339 missing","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/01\/comdlg32-ocx-error.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":25439,"url":"https:\/\/www.winhelponline.com\/blog\/mscomctl-ocx-dependencies-not-registered-missing\/","url_meta":{"origin":117,"position":2},"title":"MSCOMCTL.OCX or dependencies not registered, file is missing","author":"Ramesh","date":"January 1, 2022","format":false,"excerpt":"When you attempt to run a program created using Visual Basic 6.0 or Visual FoxPro 6.0 on a Windows 11\/10 computer, the following error may occur: Component 'MSCOMCTL.OCX' or one of its dependencies not registered: a file is missing or invalid Let's see how to fix this error on any\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"vb6 common controls","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/01\/vb6-common-controls.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":25458,"url":"https:\/\/www.winhelponline.com\/blog\/comctl32-ocx-dependencies-not-registered-file-missing\/","url_meta":{"origin":117,"position":3},"title":"Component COMCTL32.OCX or dependencies not registered: file missing or invalid","author":"Ramesh","date":"January 2, 2022","format":false,"excerpt":"When you attempt to run a program created using Visual Basic (classic VB) on a Windows 11\/10 computer, the following error may occur: Run-time error '339': Component 'COMCTL32.OCX' or one of its dependencies not correctly registered: a file is missing or invalid If COMCTL32.OCX is missing from the Windows\\System32 or\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"comctl32.ocx extract using 7-zip","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/01\/comctl32-ocx-extract.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/01\/comctl32-ocx-extract.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/01\/comctl32-ocx-extract.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/01\/comctl32-ocx-extract.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":127,"url":"https:\/\/www.winhelponline.com\/blog\/adding-the-run-as-administrator-option-for-vbs-and-js-files\/","url_meta":{"origin":117,"position":4},"title":"Add Run as Administrator Context Menu Item for VBS and JS files","author":"Ramesh","date":"March 27, 2008","format":false,"excerpt":"By default, Windows does not include the Run as Administrator option in the context menu for Vbscript (.VBS) and JScript (.JS) files. So, to run a script elevated, you either need to launch the script from elevated Command Prompt window, or use the VBScript self-elevation method as described in article\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"add run as administrator context menu for vbs files","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/script_runas.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":372,"url":"https:\/\/www.winhelponline.com\/blog\/fix-for-richtx32-ocx-component-error-when-running-a-program\/","url_meta":{"origin":117,"position":5},"title":"Fix for RICHTX32.OCX Component Error when running a Program","author":"Ramesh","date":"July 22, 2008","format":false,"excerpt":"When you run an application built using (classic) Visual Basic 6.0, the following error message may occur, and the program terminates. Component 'RICHTX32.OCX' or one of its dependencies not correctly registered: a file is missing or invalid. (or) Failed to load control 'RichTextBox' from RICHTX32.OCX This happens if the program\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"richtx32.ocx error","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/07\/richtx32-ocx-error.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=117"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/117\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}