{"id":775,"date":"2010-11-04T15:59:23","date_gmt":"2010-11-04T13:59:23","guid":{"rendered":"http:\/\/mariusbancila.ro\/blog\/?p=775"},"modified":"2011-05-19T15:20:03","modified_gmt":"2011-05-19T13:20:03","slug":"32-bit-and-64-bit-com-servers","status":"publish","type":"post","link":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/","title":{"rendered":"32-bit and 64-bit COM Servers"},"content":{"rendered":"<p>It is possible to register both 32-bit and 64-bit versions of the same COM server on 64-bit machine. This leads to several questions such as how are they registered and which one of the two is used. I will try to answer them below. But first, let&#8217;s start with an example.<\/p>\n<p><strong>Example<\/strong><br \/>\nLet&#8217;s say we have the a simple COM local server called COM3264Server.exe. There is just one interface called ICoCOM3264Server. Here is the IDL file:<\/p>\n<pre name=\"code\" class=\"cpp\">\r\n[\r\n\tobject,\r\n\tuuid(733C70A7-F7EC-4C15-85D2-5CDB14F4110B),\r\n\tdual,\r\n\tnonextensible,\r\n\tpointer_default(unique)\r\n]\r\ninterface ICoCOM3264Server : IDispatch{\r\n   [id(1), helpstring(\"Says hello\")] HRESULT SayHello(void);\r\n};\r\n[\r\n\tuuid(2F25FC66-2380-42FD-8476-8B5917FB1BF1),\r\n\tversion(1.0),\r\n]\r\nlibrary COM3264ServerLib\r\n{\r\n\timportlib(\"stdole2.tlb\");\r\n\t[\r\n\t\tuuid(9268A299-E817-4C5D-8627-C2582B66F16D)\t\t\r\n\t]\r\n\tcoclass CoCOM3264Server\r\n\t{\r\n\t\t[default] interface ICoCOM3264Server;\r\n\t};\r\n};\r\n<\/pre>\n<p>The implementation of the method SayHello() is straight forward; it just displays a message box with a text that varies between the two architectures, x64 and x86.<\/p>\n<pre name=\"code\" class=\"cpp\">\r\nSTDMETHODIMP CCoCOM3264Server::SayHello(void)\r\n{\r\n#ifdef _WIN64\r\n   ::MessageBox(NULL, _T(\"Hello from 64-bit COM server!\"), _T(\"COM3264Server\"), MB_OK);\r\n#else\r\n   ::MessageBox(NULL, _T(\"Hello from 32-bit COM server!\"), _T(\"COM3264Server\"), MB_OK);\r\n#endif\r\n\r\n   return S_OK;\r\n}\r\n<\/pre>\n<p><strong>Registry<\/strong><br \/>\nWhen you register the COM server, the 32-bit and 64-bit versions are registered in different parts of the registry. On 64-bit machine, the registry has two views (or modes):<\/p>\n<ul>\n<li>a native view, for 64-bit application; (e.g. registry path for CLSIDs is HKEY_CLASSES_ROOT\\CLSID\\)<\/li>\n<li>a WOW64 view, which enables redirections for 32-bit applications, a process transparent to the user (e.g. registry path for CLSIDs is HKEY_CLASSES_ROOT\\Wow6432Node\\CLSID\\)<\/li>\n<\/ul>\n<p>Here is the Registry registration of the (native) 64-bit COM server (notice the registry key in the status bar of the editor, and the path to the server executable).<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"\/blog\/wp-content\/uploads\/2010\/11\/com3264server_reg64.png\" title=\"Native registry view\" class=\"alignnone\" width=\"891\" height=\"319\" \/><\/p>\n<p>On, the other hand, the 32-bit COM server is registered under the Wow6432 node.<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"\/blog\/wp-content\/uploads\/2010\/11\/com3264server_reg32.png\" title=\"Wow64 registry view\" class=\"alignnone\" width=\"891\" height=\"319\" \/><\/p>\n<p>So if both versions are registered in Windows Registry, which one is picked? Well, both the server and the client can specify which architecture to use:<\/p>\n<ul>\n<li>the COM server can do this via the <strong>PreferredServerBitness<\/strong> Registry value<\/li>\n<li>the client can do this using one of the flags <strong>CLSCTX_ACTIVATE_32_BIT_SERVER<\/strong> and <strong>CLSCTX_ACTIVATE_64_BIT_SERVER<\/strong>, which overrides the server preference<\/li>\n<\/ul>\n<p>If neither the client nor the server specifies a preference, then:<\/p>\n<ul>\n<li>If the computer that hosts the server is running Windows Server 2003 with Service Pack 1 (SP1) or a later system, then COM will try to match the server architecture to the client architecture. In other words, for a 32-bit client, COM will activate a 32-bit server if available; otherwise it will activate a 64-bit version of the server. For a 64-bit client, COM will activate a 64-bit server if available; otherwise it will activate a 32-bit server.<\/li>\n<li>If the computer that hosts the server is running Windows XP or Windows Server 2003 without SP1 or later installed, then COM will prefer a 64-bit version of the server if available; otherwise it will activate a 32-bit version of the server.<\/li>\n<\/ul>\n<p><strong>Server Preference<\/strong><br \/>\nThe server can specify its preferred architecture in the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms694319%28v=VS.85%29.aspx\">PreferredServerBitness<\/a> value under AppId (available only on 64-bit Windows). This integer value can be:<\/p>\n<ul>\n<li><strong>1<\/strong>: Match the server architecture to the client architecture. For example, if the client is 32-bit, use a 32-bit version of the server, if it is available. If not, the client&#8217;s activation request will fail.<\/li>\n<li><strong>2<\/strong>: Use a 32-bit version of the server. If one does not exist, the client&#8217;s activation request will fail.<\/li>\n<li><strong>3<\/strong>: Use a 64-bit version of the server. If one does not exist, the client&#8217;s activation request will fail.<\/li>\n<\/ul>\n<p>Here is the value set in Registry to specify the 64-bit architecture.<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"\/blog\/wp-content\/uploads\/2010\/11\/com3264server_regappid.png\" title=\"Registry AppId\" class=\"alignnone\" width=\"891\" height=\"319\" \/><\/p>\n<p>When you run the client, it launches the 64-bit version and in my example the following window pops-up:<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"\/blog\/wp-content\/uploads\/2010\/11\/com3264server_64bit.png\" title=\"64-bit COM message\" class=\"alignnone\" width=\"214\" height=\"144\" \/><\/p>\n<p>If I change the value to indicate the 32-bit architecture, the other COM server is launched and the displayed message is:<br \/>\n<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"\/blog\/wp-content\/uploads\/2010\/11\/com3264server_32bit.png\" title=\"32-bit COM message\" class=\"alignnone\" width=\"214\" height=\"144\" \/><\/p>\n<p><strong>Client Preference<\/strong><br \/>\nThe client code I used so far looked like this:<\/p>\n<pre name=\"code\" class=\"cpp\">\r\n   ICoCOM3264Server* pServer;\r\n\r\n   HRESULT hr = ::CoCreateInstance(\r\n      CLSID_CoCOM3264Server, \r\n      NULL, \r\n      CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER, \r\n      IID_ICoCOM3264Server, \r\n      (void**)&pServer);\r\n\r\n   if(SUCCEEDED(hr))\r\n   {\r\n      pServer->SayHello();\r\n\r\n      pServer->Release();\r\n   }\r\n<\/pre>\n<p>However, the 64-bit version of Windows added new flags to the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms693716%28v=VS.85%29.aspx\">CLSCTX<\/a> enumeration.<\/p>\n<ul>\n<li><strong>CLSCTX_ACTIVATE_32_BIT_SERVER<\/strong>: used to activate or connect to a 32-bit version of the server; fail if one is not registered.<\/li>\n<li><strong>CLSCTX_ACTIVATE_64_BIT_SERVER<\/strong>: used to activate or connect to a 64 bit version of the server; fail if one is not registered.<\/li>\n<\/ul>\n<p>As I mentioned earlier, if the client uses one of these flags, it overrides the server preference (specified via the PreferredServerBitness Registry value). <\/p>\n<p>In the following example, the client requests the 64-bit COM server:<\/p>\n<pre name=\"code\" class=\"cpp\">\r\n   HRESULT hr = ::CoCreateInstance(\r\n      CLSID_CoCOM3264Server, \r\n      NULL, \r\n      CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER|CLSCTX_ACTIVATE_64_BIT_SERVER, \r\n      IID_ICoCOM3264Server, \r\n      (void**)&pServer);\r\n<\/pre>\n<p>And if you run it, no matter what the server specified, the 64-bit COM server is launched.<\/p>\n<p>To read more about the subject see the MSDN links above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is possible to register both 32-bit and 64-bit versions of the same COM server on 64-bit machine. This leads to several questions such as how are they registered and which one of the two is used. I will try to answer them below. But first, let&#8217;s start with an example. Example Let&#8217;s say we &#8230; <a title=\"32-bit and 64-bit COM Servers\" class=\"read-more\" href=\"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/\" aria-label=\"Read more about 32-bit and 64-bit COM Servers\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","_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_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[237,7,211,38,146],"tags":[451,461,212,238],"class_list":["post-775","post","type-post","status-publish","format-standard","hentry","category-64bit","category-c","category-com","category-tutorials","category-windows","tag-c","tag-com","tag-registry","tag-x64"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"Learn how 32-bit and 64-bit COM servers are registered on the same machine and how the COM server and client can specify the preference for one architecture.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Marius Bancila\"\/>\n\t<meta name=\"keywords\" content=\"com,registry,x64,c++\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Marius Bancila&#039;s Blog | About code. Mostly on C++\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"32-bit and 64-bit COM Servers\" \/>\n\t\t<meta property=\"og:description\" content=\"Learn how 32-bit and 64-bit COM servers are registered on the same machine and how the COM server and client can specify the preference for one architecture.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2010-11-04T13:59:23+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2011-05-19T13:20:03+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"32-bit and 64-bit COM Servers\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Learn how 32-bit and 64-bit COM servers are registered on the same machine and how the COM server and client can specify the preference for one architecture.\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#article\",\"name\":\"32-bit and 64-bit COM Servers\",\"headline\":\"32-bit and 64-bit COM Servers\",\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/com3264server_reg64.png\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#articleImage\"},\"datePublished\":\"2010-11-04T15:59:23+02:00\",\"dateModified\":\"2011-05-19T15:20:03+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":10,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#webpage\"},\"articleSection\":\"64bit, C++, COM, Tutorials, Windows, C++, COM, registry, x64\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"position\":2,\"name\":\"IT\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"position\":3,\"name\":\"Software\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"name\":\"C++\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/#listItem\",\"name\":\"IT\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"position\":4,\"name\":\"C++\",\"item\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#listItem\",\"name\":\"32-bit and 64-bit COM Servers\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/#listItem\",\"name\":\"Software\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#listItem\",\"position\":5,\"name\":\"32-bit and 64-bit COM Servers\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/category\\\/it\\\/software\\\/c\\\/#listItem\",\"name\":\"C++\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Marius Bancila\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Marius Bancila\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#webpage\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/\",\"name\":\"32-bit and 64-bit COM Servers\",\"description\":\"Learn how 32-bit and 64-bit COM servers are registered on the same machine and how the COM server and client can specify the preference for one architecture.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/2010\\\/11\\\/04\\\/32-bit-and-64-bit-com-servers\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2010-11-04T15:59:23+02:00\",\"dateModified\":\"2011-05-19T15:20:03+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/\",\"name\":\"Marius Bancila's Blog\",\"description\":\"About code. Mostly on C++\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mariusbancila.ro\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"32-bit and 64-bit COM Servers","description":"Learn how 32-bit and 64-bit COM servers are registered on the same machine and how the COM server and client can specify the preference for one architecture.","canonical_url":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/","robots":"max-image-preview:large","keywords":"com,registry,x64,c++","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#article","name":"32-bit and 64-bit COM Servers","headline":"32-bit and 64-bit COM Servers","author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"},"image":{"@type":"ImageObject","url":"\/blog\/wp-content\/uploads\/2010\/11\/com3264server_reg64.png","@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#articleImage"},"datePublished":"2010-11-04T15:59:23+02:00","dateModified":"2011-05-19T15:20:03+02:00","inLanguage":"en-US","commentCount":10,"mainEntityOfPage":{"@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#webpage"},"isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#webpage"},"articleSection":"64bit, C++, COM, Tutorials, Windows, C++, COM, registry, x64"},{"@type":"BreadcrumbList","@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/mariusbancila.ro\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","position":2,"name":"IT","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","position":3,"name":"Software","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","name":"C++"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/#listItem","name":"IT"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","position":4,"name":"C++","item":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#listItem","name":"32-bit and 64-bit COM Servers"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/#listItem","name":"Software"}},{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#listItem","position":5,"name":"32-bit and 64-bit COM Servers","previousItem":{"@type":"ListItem","@id":"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/#listItem","name":"C++"}}]},{"@type":"Organization","@id":"https:\/\/mariusbancila.ro\/blog\/#organization","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","url":"https:\/\/mariusbancila.ro\/blog\/"},{"@type":"Person","@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author","url":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/","name":"Marius Bancila","image":{"@type":"ImageObject","@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/a84dd2831d955c38355ddea55df4df260809b88f36408bc14fd4eab8f7f131c9?s=96&d=mm&r=g","width":96,"height":96,"caption":"Marius Bancila"}},{"@type":"WebPage","@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#webpage","url":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/","name":"32-bit and 64-bit COM Servers","description":"Learn how 32-bit and 64-bit COM servers are registered on the same machine and how the COM server and client can specify the preference for one architecture.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mariusbancila.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/#breadcrumblist"},"author":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/#author"},"datePublished":"2010-11-04T15:59:23+02:00","dateModified":"2011-05-19T15:20:03+02:00"},{"@type":"WebSite","@id":"https:\/\/mariusbancila.ro\/blog\/#website","url":"https:\/\/mariusbancila.ro\/blog\/","name":"Marius Bancila's Blog","description":"About code. Mostly on C++","inLanguage":"en-US","publisher":{"@id":"https:\/\/mariusbancila.ro\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Marius Bancila's Blog | About code. Mostly on C++","og:type":"article","og:title":"32-bit and 64-bit COM Servers","og:description":"Learn how 32-bit and 64-bit COM servers are registered on the same machine and how the COM server and client can specify the preference for one architecture.","og:url":"https:\/\/mariusbancila.ro\/blog\/2010\/11\/04\/32-bit-and-64-bit-com-servers\/","article:published_time":"2010-11-04T13:59:23+00:00","article:modified_time":"2011-05-19T13:20:03+00:00","twitter:card":"summary","twitter:title":"32-bit and 64-bit COM Servers","twitter:description":"Learn how 32-bit and 64-bit COM servers are registered on the same machine and how the COM server and client can specify the preference for one architecture."},"aioseo_meta_data":{"post_id":"775","title":"32-bit and 64-bit COM Servers","description":"Learn how 32-bit and 64-bit COM servers are registered on the same machine and how the COM server and client can specify the preference for one architecture.","keywords":[{"label":"COM","value":"COM"},{"label":"registry","value":"registry"},{"label":"x64","value":"x64"},{"label":"C++","value":"C++"}],"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-18 21:13:46","updated":"2025-12-12 07:35:21","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"author_meta":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"featured_img":null,"jetpack_publicize_connections":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Marius Bancila","author_link":"https:\/\/mariusbancila.ro\/blog\/author\/admin\/"},"uagb_comment_info":10,"uagb_excerpt":"It is possible to register both 32-bit and 64-bit versions of the same COM server on 64-bit machine. This leads to several questions such as how are they registered and which one of the two is used. I will try to answer them below. But first, let&#8217;s start with an example. Example Let&#8217;s say we&hellip;","coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/64bit\/\" class=\"advgb-post-tax-term\">64bit<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/c\/\" class=\"advgb-post-tax-term\">C++<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/software\/com\/\" class=\"advgb-post-tax-term\">COM<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/articles_and_tutorials\/tutorials\/\" class=\"advgb-post-tax-term\">Tutorials<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/windows\/\" class=\"advgb-post-tax-term\">Windows<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">64bit<\/span>","<span class=\"advgb-post-tax-term\">C++<\/span>","<span class=\"advgb-post-tax-term\">COM<\/span>","<span class=\"advgb-post-tax-term\">Tutorials<\/span>","<span class=\"advgb-post-tax-term\">Windows<\/span>"]},"tags":{"linked":["<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/windows\/\" class=\"advgb-post-tax-term\">C++<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/windows\/\" class=\"advgb-post-tax-term\">COM<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/windows\/\" class=\"advgb-post-tax-term\">registry<\/a>","<a href=\"https:\/\/mariusbancila.ro\/blog\/category\/it\/windows\/\" class=\"advgb-post-tax-term\">x64<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">C++<\/span>","<span class=\"advgb-post-tax-term\">COM<\/span>","<span class=\"advgb-post-tax-term\">registry<\/span>","<span class=\"advgb-post-tax-term\">x64<\/span>"]}},"comment_count":"10","relative_dates":{"created":"Posted 16 years ago","modified":"Updated 15 years ago"},"absolute_dates":{"created":"Posted on November 4, 2010","modified":"Updated on May 19, 2011"},"absolute_dates_time":{"created":"Posted on November 4, 2010 3:59 pm","modified":"Updated on May 19, 2011 3:20 pm"},"featured_img_caption":"","series_order":"","jetpack_shortlink":"https:\/\/wp.me\/pYNdv-cv","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/comments?post=775"}],"version-history":[{"count":9,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/775\/revisions"}],"predecessor-version":[{"id":989,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/posts\/775\/revisions\/989"}],"wp:attachment":[{"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/media?parent=775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/categories?post=775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariusbancila.ro\/blog\/wp-json\/wp\/v2\/tags?post=775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}