News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Weird problem with UpdateResource

Started by jj2007, November 28, 2016, 01:39:13 AM

Previous topic - Next topic

jj2007

Tim discovered this by accident when trying to insert a manifest into one of my gdi+ exercises:
Quote from: TWell on November 27, 2016, 12:37:11 AM
Have anyone idea, why GuiImage.exe is not a valid Win32 application with this manifest<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="Co.Prd.Prg" type="win32" />
<dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls"
version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*" />
</dependentAssembly></dependency></assembly>
EDIT: manifest wasn't a problem.

The exe was trashed. After a lot of testing, I could identify the culprit in the MasmBasic source:
sgSeg segment public DWORD 'BSS' ; special segment for SetGlobals
  align 16
  gvStart dd ?
  ORG gvStart+4096-1
  db ?
sgSeg ends

When opened with PeView, this segment appeared at the end of executables - and this worked just fine, except when trying to change the regular .rsrc section with UpdateResource.

In the meantime, I've removed this segment (it was not needed anyway), so MB 27NovV2 is OK for updating resources.
In the process of testing, I also discovered that a file named UpdateResource.exe requires elevation (same for Setup.exe and a few other "reserved" exe names). Launching it with CreateProcess just fails silently, but GetLastError reveals the problem. I've added a check to RichMasm; testbed attached.

On a side note (Windows SDK Support Team Blog):
QuoteIf you are wondering how Windows launches a manifested application, it is internally calling ShellExecute(), ShellExecuteEx().
manifest insanity ::)

jj2007

Just discovered a pretty odd behaviour of GdipCreateBitmapFromStream: It works for TIFF images if there is no XP manifest. Otherwise it chokes for some types of tiff images, e.g. with invalid parameter.

Testbed attached, extract to a folder and drag a tiff over the exe.

TWell

Windows 8.1:
Both programs shows TIFFs.

Siekmanski

Both exe files -> "Could not open multipage_tiff_example.tif for Recall, FileRead$ etc." and then exits.
Creative coders use backward thinking techniques as a strategy.

jj2007

Thanks for testing, Tim & Marinus :icon14:

Quote from: Siekmanski on May 18, 2017, 11:36:02 PM
Both exe files -> "Could not open multipage_tiff_example.tif for Recall, FileRead$ etc." and then exits.

Did you extract the two tiffs to the same folder, and drag them over the exe?

For me, both exes work under Win10. Only Win7-64 has the problem.

In my XP VM, the smaller tiff works fine, the other one works with none of the exes :(

Siekmanski

No, I launched the executables instead of dragging the images over the exe.
When I did, both work as a charm and they play the animation from the MultiFrame.tif  8)

ortex.tiff isn't an animation? it doesn't animate.
Creative coders use backward thinking techniques as a strategy.

jj2007

Quote from: Siekmanski on May 19, 2017, 12:11:21 AMortex.tiff isn't an animation? it doesn't animate.

Right, I forgot to mention that. Anybody with Win7? I'd like to know if it's OS-dependent or just my machine.

HSE

Equations in Assembly: SmplMath

jj2007


HSE

XpManifest launch the error message.







<---   only smartest see here  :biggrin: ( not so easy to align the line)
Equations in Assembly: SmplMath