{"id":589,"date":"2025-10-26T11:40:52","date_gmt":"2025-10-26T10:40:52","guid":{"rendered":"https:\/\/www.silverice.it\/IpercubeTechWP1\/?page_id=589"},"modified":"2025-10-26T11:40:52","modified_gmt":"2025-10-26T10:40:52","slug":"isassembly64bit","status":"publish","type":"page","link":"https:\/\/www.silverice.it\/IpercubeTechWP1\/ipercube-utilities\/assembly-info\/isassembly64bit\/","title":{"rendered":"Check if an Assembly Is 64 Bit"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Determines whether the specified .NET assembly is compiled for a 64-bit platform.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This function uses the&nbsp;<strong>GetPEKind<\/strong>&nbsp;method to inspect the assembly\u2019s PE header and determine the platform target. It returns&nbsp;<strong>False<\/strong>&nbsp;if the analysis fails or if the assembly is not 64-bit.<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:75%\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column page-snippet is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-Geist-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-Geist-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">VB<\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>    Function IsAssembly64Bit(assembly As Assembly) As Boolean\n        Try\n            Dim peKind As PortableExecutableKinds\n            Dim machine As ImageFileMachine\n\n            ' Get the platform type\n            assembly.ManifestModule.GetPEKind(peKind, machine)\n\n            ' Check if it's x64\n            Return (peKind And PortableExecutableKinds.PE32Plus) &lt;> 0 AndAlso\n                   (machine = ImageFileMachine.AMD64 OrElse machine = ImageFileMachine.IA64)\n        Catch ex As Exception\n            Console.WriteLine(\"Error during assembly analisys: \" &amp; ex.Message)\n            Return False\n        End Try\n\n    End Function<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">Function <\/span><span style=\"color: #DCDCAA\">IsAssembly64Bit<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">assembly<\/span><span style=\"color: #D4D4D4\"> As <\/span><span style=\"color: #4EC9B0\">Assembly<\/span><span style=\"color: #D4D4D4\">) As <\/span><span style=\"color: #4EC9B0\">Boolean<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        Try<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #569CD6\">Dim<\/span><span style=\"color: #9CDCFE\"> peKind <\/span><span style=\"color: #D4D4D4\">As <\/span><span style=\"color: #4EC9B0\">PortableExecutableKinds<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #569CD6\">Dim<\/span><span style=\"color: #9CDCFE\"> machine <\/span><span style=\"color: #D4D4D4\">As <\/span><span style=\"color: #4EC9B0\">ImageFileMachine<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #6A9955\">&#39; Get the platform type<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            assembly.ManifestModule.<\/span><span style=\"color: #DCDCAA\">GetPEKind<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">peKind<\/span><span style=\"color: #D4D4D4\">,<\/span><span style=\"color: #9CDCFE\"> machine<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #6A9955\">&#39; Check if it&#39;s x64<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">Return<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #9CDCFE\">peKind<\/span><span style=\"color: #D4D4D4\"> And PortableExecutableKinds.<\/span><span style=\"color: #9CDCFE\">PE32Plus<\/span><span style=\"color: #D4D4D4\">) &lt;&gt; <\/span><span style=\"color: #B5CEA8\">0<\/span><span style=\"color: #D4D4D4\"> AndAlso<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">                   (<\/span><span style=\"color: #9CDCFE\">machine<\/span><span style=\"color: #D4D4D4\"> = ImageFileMachine.AMD64 OrElse <\/span><span style=\"color: #9CDCFE\">machine<\/span><span style=\"color: #D4D4D4\"> = ImageFileMachine.<\/span><span style=\"color: #9CDCFE\">IA64<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        Catch ex As <\/span><span style=\"color: #4EC9B0\">Exception<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            Console.<\/span><span style=\"color: #DCDCAA\">WriteLine<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;Error during assembly analisys: &quot;<\/span><span style=\"color: #D4D4D4\"> &amp; ex.<\/span><span style=\"color: #9CDCFE\">Message<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">            <\/span><span style=\"color: #C586C0\">Return<\/span><span style=\"color: #569CD6\"> False<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #DCDCAA\">End<\/span><span style=\"color: #D4D4D4\"> Try<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">End Function<\/span><\/span><\/code><\/pre><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Determines whether the specified .NET assembly is compiled for a 64-bit platform. This function uses the&nbsp;GetPEKind&nbsp;method to inspect the assembly\u2019s PE header and determine the platform target. It returns&nbsp;False&nbsp;if the analysis fails or if the assembly is not 64-bit.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":545,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-589","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.silverice.it\/IpercubeTechWP1\/wp-json\/wp\/v2\/pages\/589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silverice.it\/IpercubeTechWP1\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.silverice.it\/IpercubeTechWP1\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.silverice.it\/IpercubeTechWP1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silverice.it\/IpercubeTechWP1\/wp-json\/wp\/v2\/comments?post=589"}],"version-history":[{"count":2,"href":"https:\/\/www.silverice.it\/IpercubeTechWP1\/wp-json\/wp\/v2\/pages\/589\/revisions"}],"predecessor-version":[{"id":591,"href":"https:\/\/www.silverice.it\/IpercubeTechWP1\/wp-json\/wp\/v2\/pages\/589\/revisions\/591"}],"up":[{"embeddable":true,"href":"https:\/\/www.silverice.it\/IpercubeTechWP1\/wp-json\/wp\/v2\/pages\/545"}],"wp:attachment":[{"href":"https:\/\/www.silverice.it\/IpercubeTechWP1\/wp-json\/wp\/v2\/media?parent=589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}