.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

gdi32.dll + unsafe code on 32+64Bit Windows

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :.NET Framework
 
Which target cpu should I use to compile a .NET 3.5 app (developed on a 32 Bit System) that contains an assembly which uses [DllImport("gdi32.dll")] static extern IntPtr CopyEnhMetaFile(IntPtr hemfSrc, IntPtr hNULL); and which also has the option checked: "Allow unsafe code" because of the following code: ((byte*) dst.Scan0.ToPointer())[(dst.Stride*y) + x] =... so that the app is able to run both on 32 and 64 Bit Windows ? If the answer is "x86", does it mean that all referenced assemblies of the app have to be compiled with "x86" or just the "app.exe" ? Thanks.


View Complete Post


More Related Resource Links

.Net code errors out in 64bit (X64) windows 2003 server

  
All, I have a simple code developed on my PC. ( 32 bit) . It has a few dll's as a reference. When i run the same code on my server 64bit (X64) windows 2003  ..( I grab everything from project directory ..\bin\Debug in the visual studio 2005 ) and i put the exe and the dll's in the same directory on the server. I get the following error Unhandled Exception: System.Runtime.InteropServices.COMException (0x80040154): R etrieving the COM class factory for component with CLSID {E063B04A-CB8B-460E-99D 0-F7D8FA2FAAA2} failed due to the following error: 80040154.          

Smart Storage: Protect Your Data Via Managed Code And The Windows Vista Smart Card APIs

  

Smart cards are a compelling alternative to the reliance on passwords, which are the weakest link in authentication systems. Get the Windows smart card programming basics here.

Dan Griffin

MSDN Magazine November 2006


ASP.NET: Combine Web and Windows Services to Run Your ASP.NET Code at Scheduled Intervals

  

If you want to schedule ASP.NET tasks, one solution is to use a Web service to provide an interface to your ASP.NET application and build a Windows service that calls to it at scheduled intervals. Thus the ASP.NET application doesn't have to own the scheduling logic. Here the author shows how to schedule your ASP.NET tasks using a Windows service to initiate the Web service call because Windows services can start themselves when Windows boots up.

Andrew Needleman

MSDN Magazine March 2005


Code Name Longhorn: A First Look at Writing and Deploying Apps in the Next Generation of Windows

  

The next version of the Microsoft Windows operating system, code-named "Longhorn," marks a significant change not only in terms of how the operating system works, but also in the way in which applications are built. The Longhorn version of Windows includes a new storage system, natural search technology, and an increased emphasis on security and trustworthy computing. Here the author provides an overview of Longhorn, focusing on the build-once, deploy n-times application model. In addition, he discusses the new language, code-named "XAML," that's used to create UI elements, then presents some working samples.

Dino Esposito

MSDN Magazine January 2004


Threading: Break Free of Code Deadlocks in Critical Sections Under Windows

  

Critical sections, a mechanism that prohibits more than one thread at a time from executing a particular section of code, is a topic that has not received much attention and thus tends not to be well understood. A solid understanding of critical sections in Windows can really come in handy when you need to track down multithreading performance issues in your code. This articles delves under the hood of critical sections to reveal information useful in finding deadlocks and in pinpointing performance problems. It also includes a handy utility program that shows all of your critical sections and their current states.

Matt Pietrek and Russ Osterlund

MSDN Magazine December 2003


Debug: Detect and Plug GDI Leaks in Your Code with Two Powerful Tools for Windows XP

  

In a previous article, the author devised a simple method to detect Graphical Device Interface (GDI) objects that are not properly released by Win32-based applications on Windows 9x platforms. Because some newer versions of Windows require a slightly different approach to GDI leaks, the author has updated his techniques for those operating systems. He builds and explains two tools designed to detect and eradicate GDI leaks in applications running on Windows XP, Windows 2000, and Windows NT.

Christophe Nasarre

MSDN Magazine January 2003


Windows Script Host: New Code-Signing Features Protect Against Malicious Scripts

  

Downloading scripts from the Web or e-mail leaves users vulnerable to security risks because scripts can't be signed. But now developers can use Windows Script Host (WSH) to hash scripts so users can verify their source and safety. With WSH, scripts can be signed or verified using all the same tools ordinarily used to sign EXE, CAB, DLL, and OCX files. This article discusses public-key cryptosystems, the process of signing and verifying scripts in WSH, and several warnings about attacks that could potentially be made against cryptographically secured scripts and ways in which to avoid them.

Eric Lippert

MSDN Magazine April 2001


Windows 7 64bit Registry access using x86 assembly

  
Hi guys, I have an assembly that is complied in x86 release mode. The assembly tries to access  a particular registry key in Win7 the key is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion  -> ProductID(tried to read this value) As the assembly is in x86 it tries to look for the key in SysWow64 node HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion -> ProductID(tried to read this value) When i went through the registry i found that the string "ProductID" is missing (!) .. (may be because i have trial version of windows 7 x64)? I just wanted to ask , is there a way to read registry key (not in wow6432node ) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion  -> ProductID  in x86 mode? Im using the following  code RegistryKey regkey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false); //reads in wow6432Node for x86 assembly string strProductID = string.empty; if (((regkey != null))) { // Get key Value of ProductId. strProductID = (string)regkey.GetValue("ProductId"); if ((string.IsNullOrEmpty(strProductID))) { //try reading another path for "ProductID" } } return strProductID ; PS:When i complie the same assembly as "Any Cpu" , the above code returns corr

How to Find out Windows service application path from Code ?

  
Dear frnds, Could you please help me to find out the path of  windows serivce exe ( application path ) from code?   Regards. Sajid P K  

Text in code windows became very blur

  
I do remember what I did but text in code windows became very blur. Another screens such as option, solution explorer are still very clear. How to fix it? I tried to reset to reset all setting but no luck.I do remember what I did but text in code windows became very blur.Another screens such as option, solution explorer are still very clear.How to fix it?I tried to reset to reset all setting but no luck.

is SQL 2000 32 bit supported on Windows 2008 R2 64bit?

  
Question as stated. Could anyone provide an official source from MS, wether is supported or not supported. Really appreciate it.

Moving part of the code/processing from Asp.net hosted in IIS to WCF-Windows Services will help to r

  
I have a web application with no user interface (GUI), this web application (asp.net) accepts some input from a program and doing some processing; In the Page Load event I am doing all processing and calling a WCF service, after receiving the response from WCF services the page get unload before writing the processing status/result to database) this asp.net application is hosted in IIS.   The WCF services is also hosted in the same machine in windows Services where IIS is hosted, I am concern about its performance of the application which is hosted in IIS.  Should I move some part of the code (processing) to another program say Create a new WCF Services and host it in Windows Services  so that the load on IIS will be reduce?  The new WCF Services will process some part of the code which IIS used to process, so helping IIS to reduce the load.       By moving some part of code from asp.net [processing] to another program hosted in WCF- Windows Services in same machine will able to reduce the load on IIS?   Please guide me.. Thanks Shaju

Error while trying to register DLLs for Microsoft Jet on Windows Server 2008 R2 64bit

  
Hello! I'm having issues with importing Excel spreadsheets into Microsoft SQL Server 2005 on a Windows Server 2008 R2 64bit server.  After browsing the web, it appears that the problem is with the DLL's used by Microsoft Jet.  I've thus attempted to re-register these DLL's.  However, I am receiving the following results. c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjetoledb40.dllSuccessful c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjet40.dllSuccessful c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjint40.dllThe module "msjint40.dll" was loaded but the entry-point DLLRegisterServer was not found c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjter40.dllThe module "msjter40.dll" was loaded but the entry-point DLLRegisterServer was not found c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjtes40.dllSuccessful c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\mswstr10.dllThe module "mswstr10.dll" was loaded but the entry-point DLLRegisterServer was not found I've set the application pool for this site to use 32bit.  Please note that due to my role on the team, other options such as using ACE are not available to me, unless I can prove that I've exhausted all other options. Thoughts? Thanks,Mike

Query crashes in MSAccess 2007 and 2010 on Windows 7 64bit, but works on 32 bit

  
Hello. I have a prepared a Database that contains 2 tables, and a Query. If you execte the query (Just a very simple join with a few where statments) Windows 7 crashes in 64 bit, but not on a 32 bit platform. Unfortunatly the Database has 300MB and is to big to be uploaded here. So if there is anyone interested at MS to get my Database, please feel free to contact me serge.dornseiffer@sdna.lu

Unable to install microsoft.NET 3.5 SP1 on windows xp, error code 1603

  
I have tried multiple times to download and install Microsoft.Net 3.5 SP1.

I get the following error log:
[11/30/09,23:02:12] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603
[11/30/09,23:24:38] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603
[11/30/09,23:36:35] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603
[11/30/09,23:38:07] WapUI: [2] DepCheck indicates Microsoft .NET Framework 2.0a is not installed.
[11/30/09,23:46:46] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603
[11/30/09,23:48:19] WapUI: [2] DepCheck indicates Microsoft .NET Framework 2.0a is not installed.
[12/01/09,00:13:45] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603
[12/01/09,00:15:17] WapUI: [2] DepCheck indicates Microsoft .NET Framework 2.0a is not installed.
[12/01/09,00:34:15] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603
[12/01/09,00:3
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend