tag:blogger.com,1999:blog-985159635193633235.post7690839666655267326..comments2024-03-25T00:30:02.127-07:00Comments on ISWIX: Managed Code CAN Access the MSIHANDLEChristopher Painterhttp://www.blogger.com/profile/12167478740431444267noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-985159635193633235.post-51332568728341340602007-07-26T10:46:00.000-07:002007-07-26T10:46:00.000-07:00Can we able to debug the C# code and C++ code (ser...Can we able to debug the C# code and C++ code (server and client) in VS.Net 2005 while installing?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-985159635193633235.post-3631122177431235882007-09-18T08:26:00.000-07:002007-09-18T08:26:00.000-07:00Hi Chris,That is what I was exactly looking for wh...Hi Chris,<br>That is what I was exactly looking for when i stumbled upon your blog and found an answer to my solution.<br>I did follow the steps as you metnioned... except that am using one MsiInterop class which I downloaded from CodeProject rather than creating my own. However, I always get an "Invalid Handle Error" when the .NET library tries to access the MSI database using the MSIHandle passed to it. I have verified that the value of Msi Handle in C# is same as in C++.<br>Do you have any idea what could go wrong? would be glad if you could help me with this!Abhishekhttp://www.blogger.com/profile/16359654665983750280noreply@blogger.comtag:blogger.com,1999:blog-985159635193633235.post-84774539941887341052011-04-07T02:02:27.646-07:002011-04-07T02:02:27.646-07:00Hii,I have issue with this as followingI have used...Hii,<br><br>I have issue with this as following<br><br>I have used VC++ for my setup. I had called the function during the setup, which is in my VC++ code.<br><br>The function is as followed<br><br>#pragma unmanaged<br>#include "stdafx.h"<br>#include "MSI_Logging.h"<br>#include "stdafx.h"<br>#using <br>#include <br>#include <br>#include <br><br>using namespace System::IO;<br>using namespace System::Net;<br>using namespace System::Net::NetworkInformation;<br>using namespace System::Text;<br>using namespace System;<br>using namespace System::Collections;<br>using namespace System::Collections::Specialized;<br>using namespace System::Security::Cryptography;<br><br> <br><br>BOOL APIENTRY DllMain( HANDLE hModule,<br> DWORD ul_reason_for_call,<br> LPVOID lpReserved )<br>{<br> return TRUE;<br>}<br><br> <br><br>UINT __stdcall SampleFunction2 ( MSIHANDLE hModule )<br>{<br> MessageBox(NULL, "Hello world", "CodeProject.com", MB_OK);<br> array ^initVectorBytes = System::Text::Encoding::ASCII->GetBytes("@1B2c3D4e5F6g7H8");<br> array ^saltValueBytes = System::Text::Encoding::ASCII->GetBytes("s@1tValue");<br> array ^cipherTextBytes = Convert::FromBase64String("EMf/6yaltP7MXPoRo+XF6nwe3M0dzobeXY9UpSoSPTM=");<br><br> <br> PasswordDeriveBytes^ password = gcnew PasswordDeriveBytes ("BFEBFBFF0001067A", saltValueBytes,"MD5",9);<br> array ^keyBytes = password->GetBytes(192 / 8);<br><br> RijndaelManaged^ symmetricKey = gcnew RijndaelManaged;<br> symmetricKey->Mode = CipherMode::CBC;<br><br> ICryptoTransform^ decryptor;<br> decryptor=symmetricKey->CreateDecryptor(keyBytes,initVectorBytes);<br><br> MemoryStream^ memoryStream = gcnew MemoryStream(cipherTextBytes);<br> CryptoStream^ cryptoStream = gcnew CryptoStream(memoryStream,decryptor,CryptoStreamMode::Read);<br><br> array ^plainTextBytes;<br> plainTextBytes = gcnew array(cipherTextBytes->Length);<br> int decryptedByteCount;<br> decryptedByteCount = cryptoStream->Read(plainTextBytes,0,plainTextBytes->Length);<br> <br> memoryStream->Close();<br> cryptoStream->Close();<br><br> String^ plainText;<br><br> plainText = Encoding::UTF8->GetString(plainTextBytes,0,decryptedByteCount);<br> return ERROR_SUCCESS;<br>}<br><br>This is is the function which I called during my setup. I refer following to call this function<br><br>http://www.codeproject.com/KB/install/msicustomaction.aspx<br><br>When I am run this setup I got following error<br><br>"Attemp to use MSIL code from this assembly during native code initialization.<br>This indicates a bug in your application. It is most likely the result of calling an MSIL-compiled (/clr) function from a native constructor or from DLLMain"<br><br>What should I do?<br><br>Thanks,<br><br>AnkitAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-985159635193633235.post-77628754537894543142011-04-07T04:52:16.901-07:002011-04-07T04:52:16.901-07:00This thread is completely OBE by the launch of WiX...This thread is completely OBE by the launch of WiX's DTF solution. I would investigate that and forget about the mixed mode C++ stuff.Christopher Painterhttp://www.blogger.com/profile/12167478740431444267noreply@blogger.com