简体   繁体   English

在 Windows 8.1 中运行 Visual Studio 6 C++

[英]Running Visual Studio 6 C++ in Windows 8.1

I recently migrated my system to windows 8.1.我最近将我的系统迁移到 Windows 8.1。 Unfortunatly like some others, I am not able to start Visual Studio 6 anymore.不幸的是,像其他人一样,我无法再启动 Visual Studio 6。 The software is crashing at startup (splash screen).软件在启动时崩溃(闪屏)。

I know there are some workaround, to be able to compile with vc6 in newer IDEs, but this is not working for me, since I have to compile a huge number of project and I cannot afford of modifying all the project files 1 by 1...我知道有一些解决方法,可以在较新的 IDE 中使用 vc6 进行编译,但这对我不起作用,因为我必须编译大量项目,而且我无法一一修改所有项目文件。 ..

I already see the answer coming: that vc6 is so old, and not supported and so on... I am aware about all that!我已经看到了答案:vc6 太旧了,不支持等等......我知道这一切! But migrating a lot of code can take a long time and for now we have no other solution!但是迁移大量代码可能需要很长时间,目前我们没有其他解决方案!

Since vc6 was running just fine on Windows 8, I am sure that with some small trick we can manage to get it running under 8.1, but I haven't figured out how yet!由于 vc6 在 Windows 8 上运行良好,我确信通过一些小技巧我们可以设法让它在 8.1 下运行,但我还没有弄清楚怎么做!

Did anyone manage to start Visual Studio 6 on Windows 8.1?有没有人设法在 Windows 8.1 上启动 Visual Studio 6?

I find a simple way to solve the problem!我找到了解决问题的简单方法!

  1. Look for "MSDEV.EXE" in this path:"C:\Program Files\vc6\Common\MSDev98\Bin".在此路径中查找“MSDEV.EXE”:“C:\Program Files\vc6\Common\MSDev98\Bin”。
  2. Rename "MSDEV.EXE" as "MSDEV3.EXE".将“MSDEV.EXE”重命名为“MSDEV3.EXE”。
  3. Use compatible mode "XP SP2 or SP3".使用兼容模式“XP SP2 或 SP3”。
  4. Run MSDEV3.EXE, report error,rerun again and you will succeed!运行MSDEV3.EXE,报错,再次运行就成功了!
  5. If failed, rename MSDEV.EXE as other names and use compatible mode will lead to succeed.如果失败,将 MSDEV.EXE 重命名为其他名称并使用兼容模式将导致成功。

I have VS6 running on Windows 8.1 fine after I found these helpful instructions: 在找到这些有用的说明后,我在Windows 8.1上运行VS6很好:

http://blog.wavosaur.com/run-visual-c-6-on-windows-8/ http://blog.wavosaur.com/run-visual-c-6-on-windows-8/

It is unusual indeed that Windows 8 retained compatibility for VS6 without this additional work, and yet Windows 8.1 does not. 确实,Windows 8在没有这项额外工作的情况下保留了VS6的兼容性,但Windows 8.1却没有。 I hope this helps! 我希望这有帮助!

I found this: http://www.wavosaur.com/forum/run%20vc6%20with%20windows%208.1%20%28if%20msdev.exe%20crashes%29-t1362.html 我发现了这个: http//www.wavosaur.com/forum/run%20vc6%20with%20windows%208.1%20%28if%20msdev.exe%20crashes%29-t1362.html

I haven't tested it yet, but I will asap and let you know ! 我还没有测试过,但我会尽快告诉你!

I have been successful with another method (similar to the method of @szc982):我已经用另一种方法成功了(类似于@szc982的方法):

  1. Go to "C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Bin"转到“C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Bin”
  2. Rename "MSDEV.exe" into "MSDEV-S.exe" (or any other name)将“MSDEV.exe”重命名为“MSDEV-S.exe”(或任何其他名称)
  3. Right-Click on "MSDEV-S.exe" > Properties > Compatibility > Change Settings for all users右键单击“MSDEV-S.exe”>属性>兼容性>更改所有用户的设置
  4. Check "Disable display scaling on high DPI settings" and click on "OK"勾选“在高 DPI 设置下禁用显示缩放”并点击“确定”
  5. Go to "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual C++ 6.0"转到“C:\ProgramData\Microsoft\Windows\开始菜单\程序\Microsoft Visual C++ 6.0”
  6. Right-Click on the shortcut "Microsoft Visual C++ 6.0" and change the target to "MSDEV-S.exe"右键单击快捷方式“Microsoft Visual C++ 6.0”并将目标更改为“MSDEV-S.exe”

I had a critical need to use VS 6 to continue development of a large MFC application on my Win8 box after upgrading to 8.1.在升级到 8.1 后,我迫切需要使用 VS 6 在我的 Win8 机器上继续开发大型 MFC 应用程序。 I followed advice from here and elsewhere to copy MSDEV.EXE into a file with a different name (let's call it MSDEVX.EXE) and to change the compatibility settings for the new program to Win 8.0.我按照这里和其他地方的建议将 MSDEV.EXE 复制到具有不同名称的文件中(我们称之为 MSDEVX.EXE)并将新程序的兼容性设置更改为 Win 8.0。 Unfortunately, the app ran very slowly as a debuggee whenever it used the HeapXxx APIs or an CHttpFile object.不幸的是,当应用程序使用 HeapXxx API 或 CHttpFile 对象时,它作为被调试对象运行得非常缓慢。 I concluded that the problem was the "Fault Tolerant Heap" shim.我得出的结论是问题出在“容错堆”垫片上。 I cast about wildly for a way to get rid of the FTH shim, and I eventually found one:我疯狂地寻找一种摆脱 FTH 垫片的方法,最终我找到了一个:

I created another copy of MSDEV.EXE -- let's call it MSDEVQ.EXE.我创建了另一个 MSDEV.EXE 副本——我们称之为 MSDEVQ.EXE。 I installed the Application Compatibility Manager and followed the instructions to create a custom database with an Application Fix for MSDEVQ.EXE.我安装了应用程序兼容性管理器并按照说明创建了一个自定义数据库,其中包含 MSDEVQ.EXE 的应用程序修复。 To create the settings, you'd think you could just copy the MSWIN8 settings and then subtract out the FTH shim.要创建设置,您可能认为您可以复制 MSWIN8 设置,然后减去 FTH 垫片。 Alas, there is a bug that prevents you from saving the resulting database.唉,有一个错误会阻止您保存生成的数据库。 Microsoft arrogantly says it won't fix this bug because you should never need to copy compatibility settings.微软傲慢地说它不会修复这个错误,因为你永远不需要复制兼容性设置。 Fine, so I copied the shims one by one, leaving out the FTH shim that's part of MSWIN8.好的,所以我一一复制了垫片,省略了作为 MSWIN8 一部分的 FTH 垫片。 I saved and installed the resulting .sdb file.我保存并安装了生成的 .sdb 文件。 Voila!瞧! No more FTH shim, and I'm back to being able to debug effectively.没有更多的 FTH 垫片,我又可以有效地调试了。

  1. Go to "C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Bin"转到"C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Bin"
  2. Rename MSDEV.exe to MSDEV-S.exe (or any other name) - first try the name mentioned before;MSDEV.exe重命名为MSDEV-S.exe (或任何其他名称)——首先尝试前面提到的名称; if it does not work then use MSDEV3-S.exe or any other name like that.如果它不起作用,则使用MSDEV3-S.exe或任何其他类似名称。
  3. Go to search by moving your mouse to the right down edge of your screen and type this C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual C++ 6.0通过将鼠标移动到屏幕的右下边缘来进行搜索,然后键入C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual C++ 6.0
  4. Open it and go to Common\MSDev98\Bin and run MSDEV3-S.exe .打开它并转到Common\MSDev98\Bin并运行MSDEV3-S.exe If that causes an error, then rerun again and hopefully you will succeed!如果这导致错误,然后重新运行,希望你会成功!

This is similar to what Francios has posted but you do not need to change the target.这类似于 Francios 发布的内容,但您不需要更改目标。

Another simple solution:另一个简单的解决方案:

  1. Make a copy of MSDEV.EXE to anything ( for example MSDEV_XP.EXE )MSDEV.EXE复制到任何内容(例如MSDEV_XP.EXE
  2. Set the compatibility of the copy MSDEV_XP.EXE to XP设置副本MSDEV_XP.EXEXP的兼容性
  3. Launch the renamed copy MSDEV_XP.EXE instead.而是启动重命名的副本MSDEV_XP.EXE

Explanation:解释:

Microsoft installs two executables, MSDEV.EXE and MSDEV.COM , one of which can be made to run in recent WINDOWS versions. Microsoft 安装了两个可执行文件MSDEV.EXEMSDEV.COM ,其中一个可以在最近的 WINDOWS 版本中运行。 If you launch MSDEV in a shell or script ( a makefile for example ), you don't want to launch the COM instead of the EXE , and making a copy with a different name solves that.如果您在 shell 或脚本(例如 makefile )中启动MSDEV ,您不想启动COM而不是EXE ,使用不同名称制作副本可以解决此问题。 (Also, if you leave the two files Microsoft installed as is, you can be sure you're not breaking any existing functionality) (此外,如果您将 Microsoft 安装的两个文件保持原样,则可以确保您没有破坏任何现有功能)

This solved my problem when I was building with a make file which I changed to call my copy that had been changed to XP compatibility.当我使用生成文件进行构建时,这解决了我的问题,我将其更改为调用已更改为 XP 兼容性的副本。 Note that I did need to use the original MSDEV.EXE in some cases, so it's good to have both.请注意,在某些情况下,我确实需要使用原始MSDEV.EXE ,因此最好同时使用两者。

Run MS-Dos as Administrator and follow instructions..以管理员身份运行 MS-Dos并按照说明进行操作。

For Windows 8.1 64bit , type:对于Windows 8.1 64bit ,键入:

ren "C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Bin\MSDEV.EXE" MSDEV3.EXE

For Windows 8.1 32bit , type:对于Windows 8.1 32bit ,键入:

ren "C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\MSDEV.EXE" MSDEV3.EXE

Now go to your desktop and right click in any empty space then choose New -> Shortcut , and then if you have Windows 8.1 64bit set the location to: C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Bin\MSDEV3.EXE现在转到您的桌面并右键单击任何空白区域然后选择New -> Shortcut ,然后如果您有Windows 8.1 64bit将位置设置为: C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Bin\MSDEV3.EXE

or if you have Windows 8.1 32bit set it to: C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\MSDEV3.EXE或者如果您有Windows 8.1 32 位,请将其设置为: C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\MSDEV3.EXE

The Fix修复

1. Delete the "DEVRES.PKG" file, but you will lose the resource editor. 1 、删除“DEVRES.PKG”文件,但会丢失资源编辑器。

or或者

2. Patch the buffer overflow in "DEVRES.PKG" with a hex editor. 2.使用十六进制编辑器修补“DEVRES.PKG”中的缓冲区溢出。

// Microsoft Visual Studio 6.0
// Crash Fix (Buffer Overflow)
//
// Module: Resource Editor
// DEVRES.PKG v6.0.8168.0 - 17.6.1998 0:00
//
// Original SHA1 : 59afd55f13310dcdbfff777fe6f4c7d0a8191a82
// Fixed SHA1    : 00bb8497adca2467eaba022a34bf4fdafd3d7c6c
// 

--------


0x00004518 / 0x50403518:

FF 25 74 1A 40 50    ; jmp     ds:__imp_??2@YAPAXI@Z ; operator new(uint)
->
E9 8F 0F 10 00 90    ; jmp     0001054AC ; nop

--------


0x001054AC / 0x505044AC:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
->
55 89 E5 8B 45 08 B9 02 00 00 00 F7 E1 50 FF 15 74 1A 40 50 59 89 EC 5D C3

55                      push   ebp
89 E5                   mov    ebp,esp
8B 45 08                mov    eax,DWORD PTR [ebp+0x8]
B9 02 00 00 00          mov    ecx,0x2
F7 E1                   mul    ecx
50                      push   eax
FF 15 74 1A 40 50       call   DWORD PTR ds:0x50401a74
59                      pop    ecx
89 EC                   mov    esp,ebp
5D                      pop    ebp
C3                      ret 

--------


0x000001E8:

AC 34 10 00
->
DC 34 10 00          ; increase .text section virtual size by 30 bytes


--------


0x00000140:

29 8D 19 00
->
77 FD 17 00          ; fix PE checksum


--------

Explanation解释

The real reason why Visual Studio 6 crashes on new hardware has actually nothing to do with your OS, it works just fine in later Windows versions too but there are multiple buffer overflows in the resource editor module (DEVRES.PKG) which have seemingly gone unnoticed all these years. Visual Studio 6 在新硬件上崩溃的真正原因实际上与您的操作系统无关,它在以后的 Windows 版本中也可以正常工作,但是资源编辑器模块 (DEVRES.PKG) 中存在多个缓冲区溢出,这些似乎没有引起注意这些年来。

The resource editor module has multiple calls to the C++ new[] operator using values that are too small without doing bound checking.资源编辑器模块多次调用C++ new[] 运算符,使用的值太小而没有进行边界检查。 But because of the way memory allocation and alignment works, it just always got "lucky" and did not crash, as the pointer memory block had more "extra" space than requested and then it wasn't overwritten or accessed by anything else before the operation was completed.但是由于内存分配和对齐的工作方式,它总是“幸运”并且没有崩溃,因为指针内存块具有比请求更多的“额外”空间,然后它没有被其他任何东西覆盖或访问操作完成。

What has changed since then, is every part of your computer has become a lot faster;从那以后发生的变化是计算机的每个部分都变得更快了。 processor, memory, I/O, the works.处理器、内存、I/O、工程。 There were no 16 core 32 thread processors in the early 2000s, nor 5000MB/s SSDs or fast memory. 2000 年代初期没有 16 核 32 线程处理器,也没有 5000MB/s 的 SSD 或快速内存。 So now when running on a modern processor, what happens is that the memory which resource editor didn't properly allocate, gets overwritten by another thread while it's still being used (yes, VS6 is multithreaded, even if very lightly so).因此,现在在现代处理器上运行时,会发生资源编辑器未正确分配的内存,在仍在使用时被另一个线程覆盖(是的,VS6 是多线程的,即使非常轻微)。

That's also the reason why all sorts of different bags of tricks work to "fix" it, what they have in common is that they change the execution path (by slowing processing down and/or changing how memory is allocated/aligned) slightly so by luck you pass the buffer overflow without crashing.这也是为什么各种不同的技巧可以“修复”它的原因,它们的共同点是它们会稍微改变执行路径(通过减慢处理速度和/或改变内存的分配/对齐方式)幸运的是,您通过了缓冲区溢出而不会崩溃。 The compatibility layer slows it down, as does running it in a VM.兼容性层会减慢它的速度,就像在 VM 中运行它一样。 Running it from a HDD instead of SSD can make the difference, changing folders, restarting the computer, or even something like running a 4K video stream in the background.从 HDD 而不是 SSD 运行它可以有所作为,更改文件夹,重新启动计算机,甚至在后台运行 4K 视频流。

I know it's 2022 but I don't think Visual Studio 6 is any less useful today than it ever was.我知道现在是 2022 年,但我不认为 Visual Studio 6 今天的用处比以往任何时候都小。 The resource editor is still the best comparing to all the new editions, and even if I code something in VS2019 I still use the editor in VC6 to design the dialogs.与所有新版本相比,资源编辑器仍然是最好的,即使我在 VS2019 中编写了一些代码,我仍然使用 VC6 中的编辑器来设计对话框。 Also if you want to just code a quick tool which will work in any Windows version without any redistributables, VC6 is still the pick.此外,如果您只想编写一个可以在任何 Windows 版本中运行而无需任何可再发行组件的快速工具,VC6 仍然是首选。

In any case, there are two ways to fix the crash for good.无论如何,有两种方法可以永久修复崩溃。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM