كيف أجبر تطبيقًا أصليًا على استخدام وقت تشغيل C الأقدم

StackOverflow https://stackoverflow.com/questions/3097592

سؤال

يقوم Visual Studio 2010 بتثبيت الإصدار ... 4974 من وقت تشغيل VC9 الذي .pdbs غير متوفرة. كيف يمكنني إجبار بلدي GME.exe لاستخدام وقت تشغيل VC9 الأقدم؟

لقد حاولت وضع هذا في GME.exe.config:

<?xml version="1.0"?>
<configuration>
  <windows>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <assemblyIdentity type="win32" name="GME" processorArchitecture="x86" version="1.0.0.1"/>
      <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" publicKeyToken="1fc8b3b9a1e18e3b" processorArchitecture="x86" />
        <bindingRedirect oldVersion="9.0.21022.8-9.0.21022.4974" newVersion="9.0.30729.4148" />
        <bindingRedirect oldVersion="9.0.30729.0-9.0.30729.4974" newVersion="9.0.30729.4148" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.VC90.MFC" publicKeyToken="1fc8b3b9a1e18e3b" processorArchitecture="x86" />
        <bindingRedirect oldVersion="9.0.21022.8-9.0.21022.4974" newVersion="9.0.30729.4148" />
        <bindingRedirect oldVersion="9.0.30729.0-9.0.30729.4974" newVersion="9.0.30729.4148" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.VC90.ATL" publicKeyToken="1fc8b3b9a1e18e3b" processorArchitecture="x86" />
        <bindingRedirect oldVersion="9.0.21022.8-9.0.21022.4974" newVersion="9.0.30729.4148" />
        <bindingRedirect oldVersion="9.0.30729.0-9.0.30729.4974" newVersion="9.0.30729.4148" />
      </dependentAssembly>
    </assemblyBinding>
  </windows>
</configuration>

ومع ذلك ، تقارير SXStrace:

INFO: Resolving reference Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
....
INFO: Publisher Policy redirected assembly version.

مضيفا <publisherPolicy apply="no"/> تحت <dependentAssembly> النتائج في ERROR: Activation Context generation failed. مع عدم وجود معلومات مفيدة أخرى على Windows 7.

لاحظ أن هذا هو فقط لتصحيح نسختي المحلية ، وليس إعادة التوزيع ، لذلك لست قلقًا بشأن تحديثات الأمان أو الفوائد الأخرى لسياسة الناشر.

هل كانت مفيدة؟

المحلول 2

إليك الحيلة للحصول على تكوين التطبيق للعمل مع Win2003 وبعد ذلك:

http://www.tech-archive.net/archive/vc/microsoft.public.vc.ide_general/2008-01/msg00033.html

في الأساس ، يحتاج المرء إلى إضافة التطبيق إلى قاعدة بيانات التوافق مع "EnableAppConfig"

تم توثيق هذا هنا:

http://msdn.microsoft.com/en-us/library/EE710783٪28Vs.85٪29.aspx

عمل GME.exe.Config:

<?xml version="1.0"?>
<configuration>
  <windows>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
        <publisherPolicy apply="no"/>
        <bindingRedirect oldVersion="9.0.21022.0-9.0.21022.4974" newVersion="9.0.30729.1" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.VC90.MFC" publicKeyToken="1fc8b3b9a1e18e3b" processorArchitecture="x86"/>
        <publisherPolicy apply="no"/>
        <bindingRedirect oldVersion="9.0.21022.0-9.0.21022.4974" newVersion="9.0.30729.1" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.VC90.ATL" publicKeyToken="1fc8b3b9a1e18e3b" processorArchitecture="x86"/>
        <publisherPolicy apply="no"/>
        <bindingRedirect oldVersion="9.0.21022.0-9.0.21022.4974" newVersion="9.0.30729.1" />
      </dependentAssembly>

    </assemblyBinding>
  </windows>
</configuration>

يبدو أن المرء يحتاج إلى القيام بذلك من أجل تحميل.

نصائح أخرى

الجواب يأتي من http://blog.kalmbachnet.de/؟postid=80

الحيلة هي الإزالة من عرض التطبيق publicKey ميزة على assemblyIdentity لذلك لا يتم استخدام WINSXS.

GME.exe.manifest:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.4148" processorArchitecture="x86">
      </assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.MFC" version="9.0.30729.4148" processorArchitecture="x86">
      </assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.ATL" version="9.0.30729.4148" processorArchitecture="x86">
      </assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*">
      </assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>

تضمين البيان في GME.exe (بديل 1 ل 2 لتعديل DLLs):
mt -manifest GME.exe.manifest -outputresource:GME.exe;1

ثم انسخ DLLs اللازمة:
cp -a windows/winsxs/x86_microsoft.vc90.{atl,crt,mfc}*30729.4148*/*dll path-to-app/

ثم قم بإنشاء إظهار لكل مجموعة لا يتم استخدام SXS لها ووضعها بجوار التطبيق. تستند البيان على EG C:\Windows\WinSxS\Manifests\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2.manifest:
Microsoft.VC90.CRT.Manifest:

<?xml version="1.0"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.4148" processorArchitecture="x86"></assemblyIdentity>
    <file name="msvcr90.dll"></file>
    <file name="msvcp90.dll"></file>
    <file name="msvcm90.dll"></file>
</assembly>

لا يمكن إزالة مراجع التجميع من بيان التطبيق ، حيث يشكو CRT من أنه لا يتم تحميله عبر SXS.

لسوء الحظ ، يبدو أنه يجب على المرء تعديل البيان لكل DLL التابع في التطبيق ، بما في ذلك DLLs النسخ من WINSXS ، أو قد يتم تحميل إصدارات متعددة.

إليك برنامج نصي bash الذي عمل بالنسبة لي ، حيث يحتوي ~/documents/sxs-hack/يحتوي على dlls crt والبيانات المعدلة:

rm -rf bin
mkdir bin
cp -a ~/Documents/sxs-hack/* bin/
find -iname \*.dll -or -iname \*.ocx -or -iname \*.exe | while read -r file; do
  cp -a "$file" bin/"$(basename $file)"
  export file=bin/"$(basename $file)"
  export res=$file\;2
  if [ ${file:${#file}-3} = "exe" ]; then export res=$file\;1; fi
  echo $file
  mt.exe -nologo -inputresource:"$res" -out:extracted.manifest &&
  perl -pli -e 's/(Microsoft.VC90.[^>]*)version="[^"]*"([^>]*)publicKeyToken="[^"]*"/$1 $2 version="9.0.30729.4148"/g;' extracted.manifest &&
  mt -nologo -manifest extracted.manifest -outputresource:"$res"
  regsvr32 /s "$file" || true
done

إذا كان لديك المصدر ، فيمكنك دائمًا ربط مكتبة C-Runtime التي تريد استخدامها ... ليس دائمًا أعظم فكرة ولكن إذا ورثت مكتبة وحش تعمل فقط في وضع التصحيح ولا يمكنك ذلك إعادة توزيع Debug CRT سوف يقوم بالخدعة ...

إليك كيفية تعطيل سياسة الناشر على Vista أو 7:

انتقل إلى hkey_local_machine software microsoft windows currentversion sidebyside winners x86_policy.9.0.microsoft.vc90.crt_1fc8b3b9a1e18e3b_none_02d1067219 9

اضبط المفتاح الافتراضي على الإصدار الذي تريده ، على سبيل المثال 9.0.30729.4148. قم بتعيين الإصدار الذي لا تريده إلى 0 ، على سبيل المثال "9.0.30729.4974" = 00.

يجب عليك القيام بذلك من أجل CRT ، ATL ، MFC ، إلخ.

يبدو أن WINSXS يخدع السياسة. لقد نجح هذا الأمر بالنسبة لي: Touch (1) التطبيق ، ثم قم بتعيين HKEY_LOCAL_MACHINE Software Microsoft Windows CurrentVersion Sidebyside PublisherPolicyChangetime إلى شيء منخفض ، على سبيل المثال 10.

سيؤدي ذلك إلى تعطيل وقت التشغيل الأحدث للنظام بأكمله.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top