Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Flasche

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 ;)

Share this post


Link to post
Share on other sites

Video uploaded to youtube. Being put in spoiler at top. Here is the video if you are impatient

 

Edited by Flasche

Share this post


Link to post
Share on other sites

thanks for the tutorial, Flasche.

 

Anytime LostInSpace

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

It's not the compression, it's the write privilege on the .text section:

 

Thank you for clarifying.

Share this post


Link to post
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

Share this post


Link to post
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.

gccfix.7z

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thank you! Is that... Visual Basic? It's gonna take me a while, now I'm fighting with wine. No, not WINE - real wine. :blushing:

(I know it's irrelevant, but we're only human after all...)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...