Jump to content

UPXing Compatibility


Recommended Posts

thanks, man! oh and thanks for the link to KEXT: DIY extensions it wasn't pinned, or it was a few pages back, guess I didn't see it.

 

Kind of so so. Really it was there, but very unnoticeable. The link to the kext page was on the signature of jumper's posts. (At the bottom, says kexter)

 

Design feedback requested:

IHAtool - IpHlpApi tester; call various functions and report results

--status-> framework is solid; 22 api's fully supported; preview release coming soon

ComDlg32 wrapper - ComDlgEx meets IpHlpApi wrapper

--status-> PrintDlgExW working in latest SumatraPDF 8^)

Future projects: ImportPatcher40 - dialog interface; Kexter - IP40+Ktree+Kexstubs

 

 

P.S. Good luck on your YouTube career :-) If I somehow learn Windows ME Movie Maker, I might "direct" some of my own videos. :-)

 

Thanks. I look forward to it ;)

Link to comment
Share on other sites


Ok, so I need this explained to me. Why would I want to compress a program to run it? I can already run VLC, so what would compressing it with UPX do? And why UPX? Why not some other compression format?

Link to comment
Share on other sites

Ok, so I need this explained to me. Why would I want to compress a program to run it? I can already run VLC, so what would compressing it with UPX do? And why UPX? Why not some other compression format?

 

Please read this topic starting from here http://www.msfn.org/board/topic/152471-kernelex-apps-compatibility-list-new/page-13#entry1072080

Link to comment
Share on other sites

Ok, so I need this explained to me. Why would I want to compress a program to run it? I can already run VLC, so what would compressing it with UPX do? And why UPX? Why not some other compression format?

It's not the compression, it's the write privilege on the .text section (the first two sections in a UPX-compressed file are both writable):

Changing the .text section to be writable or UPXing the problem files both work.... UPXing is still the easiest/best work-around. :)

I plan to add an option to ImportPatcher to automatically fix the app and all dependencies.

edit: more clarity

Edited by jumper
Link to comment
Share on other sites

Just a heads up: CloudMe 1.8.1 has been released on May 12 and still works with the UPX method.

Not sure if I mentioned it already in the other thread, but I already have VC9 and VC10 runtimes (patched) in the System folder, so I moved those that came with CloudMe out of its folder. The VC11 runtimes should stay. This may be important if the unpatched runtimes won't work even after UPX-ing.

 

I also wrote a small AHK script that automates the UPX packing of the files, if anyone cares. It saves a log and attempts to set KernelEx compatibility for unloadable libraries (this may not work). With a few small changes it could be made to pack files in any folder. The upx.exe must be in the same folder with the script and it's highly recommended to run it from a short path, such as C:\upx, C:\Temp or similar.

AHK Basic (ANSI) can hopefully be found here.

; Packs CloudMe libraries and executables#SingleInstance, ForceListLines, OffSetControlDelay, -1SetWinDelay, -1SetBatchLines, -1StringCaseSense, OffDetectHiddenWindows, OnRegRead, ipath, HKLM, Software\CloudMe\CloudMeSync, Install_Dirlogfile := A_ScriptDir "\CloudMe_log.txt"log=k := "HKLM", sk := "Software\KernelEx\AppSettings\"IfExist, %logfile%	FileDelete, %logfile%Loop, %ipath%\*.*, 0, 1	{	if A_LoopFileName in msvcp90.dll,msvcr90.dll,msvcp100.dll,msvcr100.dll		if FileExist(A_WinDir "\System\" A_LoopFileName)			FileMove, %ipath%\%A_LoopFileName%, %ipath%\%A_LoopFileName%.000	else if A_LoopFileExt in dll,exe		{		i := A_LoopFileLongPath		runwait, %A_ScriptDir%\upx.exe -1 -v -k "%A_LoopFileLongPath%",, Hide UseErrorLevel		log .= "File: " i " Error: " A_LastError " (exit code: " ErrorLevel ")"		StringUpper, i, i		if !h := DllCall("LoadLibrary", "Str", i)			RegWrite, REG_SZ, %k%, %sk%Configs, %i%, WINXP		else DllCall("FreeLibrary", "UInt", h)		RegWrite, REG_DWORD, %k%, %sk%Flags, %i%, % (h ? 0x1 : 0x0)		log .= " handle: " h "`n"		}	}FileAppend, %log%, %logfile%msgbox, Finished packing CloudMeExitApp
Edited by Drugwash
Link to comment
Share on other sites

  • 1 month later...

For the last week, I've been testing CloudMe_182. It suffers from the same problem as vlc-2.1.3-win32.7z and slightly more. In addition to needing the .text section protection changed to allow writing, it also needs the .rdata section changed as well.

Upx391 didn't like the CloudMe_182 PE files, so I finally wrote a tool called gccfix to do the patching. It is very quick and processes individual files or whole directory structures. gccfix patches in-place, so backup first or keep the original installer or archive.

gccfix.7z

Link to comment
Share on other sites

Is there any hope of getting Firefox 13+ running with UPX? I am interested since I would like to use a newer browser. Opera 12.02 is good but is starting to get old. It's just a simple MSVCR100.dll error so it should be fixable.

Edited by ironman14
Link to comment
Share on other sites

For the last week, I've been testing CloudMe_182. It suffers from the same problem as vlc-2.1.3-win32.7z and slightly more. In addition to needing the .text section protection changed to allow writing, it also needs the .rdata section changed as well.

Upx391 didn't like the CloudMe_182 PE files, so I finally wrote a tool called gccfix to do the patching. It is very quick and processes individual files or whole directory structures. gccfix patches in-place, so backup first or keep the original installer or archive.

 

Thanks jumper, very useful!

Link to comment
Share on other sites

@Jumper: May I have the sources for this GCC patcher , please? I'd like to try an AHK approach with auto-backup option.

 

Oh and they don't stop; on June 27 they released version 1.8.3. Just downloaded it, haven't yet tried to UPX or patch it.

 

Later edit: I've succesfully UPX-ed v 1.8.3 and it appears to work. At least it does connect/disconnect, since I got no files to sync at this moment. Haven't tried gccfix.

Edited by Drugwash
Link to comment
Share on other sites

Here's the core function. Full source attached below.

(The mbf function is just a printf into a MessageBox.)

void doFile (LPSTR szMod) {  LOADED_IMAGE  li;  UINT          bPatch = 0;  iFiles++;  //mbf (szAppName" - %u:%u:%u - %s", iFiles, nFiles, nPatchedFiles, GetLFN (szMod));  if (!hwndPB) return;  // only count on 1st pass  swtf (szAppName" - %u / %u : %u - %s", iFiles, nFiles, nPatchedFiles, GetLFN (szMod));  SendMessage (hwndPB, PBM_STEPIT, 0, 0);  Sleep (40);  if (!MapAndLoad (szMod, NULL, &li, FALSE, FALSE)) return;  do {    //if (li.FileHeader->OptionalHeader.MajorLinkerVersion != 2) break;    //if (li.FileHeader->OptionalHeader.MinorLinkerVersion < 22) break;    if (((PUINT)(li.Sections[0].Name))[0]=='xet.' &&        ((PUINT)(li.Sections[0].Name))[1]==   't' &&        ((PBYTE)(&li.Sections[0].Characteristics))[2] &&        ((PBYTE)(&li.Sections[0].Characteristics))[3]<0x80) {      //mbf ("%s\n\n.text section is now writable", GetLFN(szMod));      ((PBYTE)(&li.Sections[0].Characteristics))[3] |= 0x80;      bPatch++;    }    if (li.NumberOfSections > 2 &&        ((PUINT)(li.Sections[2].Name))[0]=='adr.' &&        ((PUINT)(li.Sections[2].Name))[1]==  'at' &&        ((PBYTE)(&li.Sections[2].Characteristics))[2] &&        ((PBYTE)(&li.Sections[2].Characteristics))[3]<0x80) {      //mbf ("%s\n\n.rdata section is now writable", GetLFN(szMod));      ((PBYTE)(&li.Sections[2].Characteristics))[3] |= 0x80;      bPatch++;    }  } while (0);  if (bPatch) nPatchedFiles++, UnMapAndLoad (&li);} // doFile

gccfix.src.7z

Edited by jumper
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...