|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
[BUG] VS 2005, Manifest mechanism and redistrib DLLs - VS2005_Manifest_bug.zip (0/1)I found 2 bugs related to VS 2005 and the new way of redistributing the MS DLLs which uses the Manifest mechanism. In order for everybody to be able to follow my steps I'll make a detailed description, so sorry for the long post. There are 2 ways to deploy the MS runtime DLLs: A) Deploying the ms dlls using the "Deploying Visual C++ library DLLs as private assemblies" method B) Deploying the ms dlls using the "Deploying Visual C++ library DLLs as shared assemblies" method (run the vcredist_x86.exe on the target machine) I'll discuss the problems I found for both of these in detail. A) Deploying the ms dlls using the "Deploying Visual C++ library DLLs as private assemblies" method: - Create 2 VS 2005 console empty applications (meaning manifest is embedded and flag /MD is used), one called sample and one called momo (see attached VS2005_Manifest_bug\sources\) - the code for momo should contain just a printf("I am momo"); (see attached VS2005_Manifest_bug\sources\momo) - the code for sample should contain smth like (see attached VS2005_Manifest_bug\sources\sample): /* The application takes 1 param: - 1 means only "\" - 2 means only "/" - 3 means a mixture between them - anything else means "\./" */ #include <windows.h> #include <stdio.h> #include <tchar.h> void main(int argc, TCHAR* argv[]) { TCHAR myPath[MAX_PATH]; if (argc < 2) { printf("No param!\n"); return; } if (_tcscmp(argv[1], _T("1")) == 0) { printf("Path with only backslashes\n"); _tcsncpy_s(myPath, MAX_PATH, _T("C:\\Program Files\\Momo\\momo.exe"), MAX_PATH-1); } else if (_tcscmp(argv[1], _T("2")) == 0) { printf("Path with only slashes\n"); _tcsncpy_s(myPath, MAX_PATH, _T("C:/Program Files/Momo/momo.exe"), MAX_PATH-1); } else if (_tcscmp(argv[1], _T("3")) == 0) { printf("Path with a mixture between backslashes and slashes\n"); _tcsncpy_s(myPath, MAX_PATH, _T("C:\\Program Files\\Momo/momo.exe"), MAX_PATH-1); } else { printf("Path with a mixture between backslash DOT slash\n"); _tcsncpy_s(myPath, MAX_PATH, _T("C:\\Program Files\\Momo\\./momo.exe"), MAX_PATH-1); } STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory (&pi, sizeof (pi)); ZeroMemory (&si, sizeof (si)); si.cb = sizeof (si); si.dwFlags = STARTF_USESHOWWINDOW; if(!CreateProcess(myPath, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { printf("Couldn't start the application!\n"); return; } CloseHandle (pi.hThread); printf("Started the application!\n"); } - after building the RELEASE configuration of the sample and momo you should get: sample.exe, momo.exe - on a computer with no VS 2005 installed (this is very important) and where the DLLs haven't yet been installed in C:\Windows\WinSxs by other applications, copy the following: - in one directory, eg C:\sample copy: sample.exe and the whole content of the %PROGDIR%\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT directory from your dev machine (DLLs and manifest) - one directory in C:\Program Files\Momo (can be another, but then pls change accordingly the sample above) where you copy: momo.exe and the whole content of the %PROGDIR%\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT directory from your dev machine (DLLs and manifest) - run the sample.exe with param 1, 2, 3 and 4 (as you can see from the sample above: 1 means the path that goes to CreateProcess has only "\" backslashes, 2 only "/" slashes, 3 mixture between them, 4 "\./") You will get the following behaviour: - For Windows 2k everything works just fine - For WinXP: - param 1 -> OK - param 2 -> error: "Couldn't start the application" and in event viewer are 2 errors: - one: "Generate Activation Context failed for C:/Program Files/Momo/momo.exe.Reference error message: The operation completed successfully" (see attached VS2005_Manifest_bug\errors_jpgs\event1.JPG) - second: "Resolve Partial Assembly failed for Microsoft.VC80.CRT. Reference error message: An internal error occured" (see attached VS2005_Manifest_bug\errors_jpgs\event2.JPG) - param 3 -> error: "The application failed to initialize properly (0xc0000034)" (see attached VS2005_Manifest_bug\errors_jpgs\msg.JPG) - param 4 -> OK From cmd prompt by running momo.exe with all those formats for path works with no problems. As on http://msdn2.microsoft.com/en-us/library/77859s1t.aspx is stated: "UNIX supports only the forward slash (/) for this purpose, whereas Win32 operating systems support both the backslash (\) and the forward slash (/).", I assume the above behaviour is b/c of a bug as "/" should be supported in a path, and as this works with /MT flag or with VS 2003 /MT and /MD. This is one bug I wanted to report. B) Deploying the ms dlls using the "Deploying Visual C++ library DLLs as shared assemblies" method (run the %PROGDIR%\Microsoft Visual Studio 8\SDK\v2.0\Bootstrapper\Packages\vcredist_x86\vcredist_x86.exe on the target machine): everything works OK, regardless the path used in CreateProcess, but there seems to also be a bug: on WinXP Professional no ServicePack and no VS installed, when running vcredist_x86.exe (manually or through the installer) there is an error: "Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor" (see attached VS2005_Manifest_bug\errors_jpgs\vcredist_err.JPG). Works ok on WinXP SP2. Again, I assume the fact that this exe can't be run on a WinXP with no SP is a bug. This is the second bug I wanted to report. I will attach also the VS2005_Manifest_bug.zip which contains the screenshots of the errors I get and the source for the small dummy samples needed to prove the bugs. Viv
Other interesting topics
Efficient regular expression pattern ?
Can we use dlls build with VS2005 with old apps? How to define Type T for List<T> at runtime sending fax using .NET Save running assembly to disk. Memory leak when SmtpMail and MailMessage are used. Building from command line Ending an app programmatically [BUG] VS 2005, Manifest mechanism and redistrib DLLs - VS2005_Manifest_bug.zip (0/1) Missing ASP.NET tab in IIS , last but not least! |
|||||||||||||||||||||||