Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS rejects style #29

Closed
Kaiton121 opened this issue Mar 23, 2019 · 19 comments
Closed

OS rejects style #29

Kaiton121 opened this issue Mar 23, 2019 · 19 comments
Labels

Comments

@Kaiton121
Copy link

When I open any theme in the editor (original aero.msstyle or any custom theme) I can't test it 'because the OS rejects it' even before I changed anything. If I save it and move it to it's corresponding directory in /Windows/Resources and change the theme it will just keep the skins, color etc of the last theme that was active. I also tried Visual Style Builder and it behaved in the same way. I have patched the system with UX Patcher and other custom themes from the net work perfectly well.

OS: Windows Pro x64
10.0.17763 Bld. 17763

Thanks in advance.

@nptr
Copy link
Owner

nptr commented Mar 23, 2019

Sounds weird to me that WSB and my tool won't work, but other custom themes do...because this are the only tools (afaik) that could have created those custom themes.

To find the problem, could you:

  • find a custom theme that works
  • open and save it with the latest msstyleEditor and verify that it won't work anymore
  • send me the non-working style
  • send me the original working style (or link it to me)

I'll then do a binary comparison between the original, your saved file and my saved file (that i'll create) and try to figure out what went wrong.

@nptr nptr added the bug label Mar 23, 2019
@Kaiton121
Copy link
Author

Kaiton121 commented Mar 23, 2019

Thanks for your quick reply!

I tried it using the standard aero file and a custom theme called junguru
(it contains various styles, the one I am using has following default path if you want to download it: \Janguru Theme for Windows 10\Themes\Darker\Basic\AddressBar\Janguru\classic.msstyles)

I attached a .zip containing the files you requested:
x.mssytles was opened in the editor and the saved to _not_working_x.msstyles without changing anything.

own theme.zip

@nptr
Copy link
Owner

nptr commented Mar 24, 2019

The working and not-working files are exactly the same. Not a byte different... so i am not wiser than before.

Could you use this version and try to apply the theme themes with it as well?
The error dialog shows an error code along the message this time. Maybe it helps me
figuring out whats wrong.

msstyleEditorX64_test.zip

@ZangLucarson
Copy link

ZangLucarson commented Apr 5, 2019

I'm having the same issue
image
Running Windows 8.1

@nptr
Copy link
Owner

nptr commented Apr 5, 2019

According to the docs on MSDN this means:

ERROR_RESOURCE_NAME_NOT_FOUND - 1814 (0x716)
"The specified resource name cannot be found in the image file."

So it looks like windows expects a resource, but cannot find it. Without seeing the style thats hard to tell.
Can you as well send or link me the working and not-working style?

@ZangLucarson
Copy link

Here you go! It's the default aero file, with nothing changed. I have tried loading it through msstyleeditor and it gives me the error, I used the file as a test

aero.zip

@nptr
Copy link
Owner

nptr commented Apr 8, 2019

I tested a bit, but the save msstyleEditor produces is fine, so it's something else.

Unfortunately I don't currently have a system where i can reproduce this issue so i am limited to guesses.
I'll have to set up a Win8 or 10 box again some time...

Could you try to copy the %windir%\Resources\Themes\Aero\Shell folder including its contents to %public%? (msstyleEditor is using %public% as its temporary directory when trying to apply a theme)

You should get a structure like this:

%public%\Shell\
%public%\Shell\NormalColor\
%public%\Shell\NormalColor\shellstyle.dll
%public%\Shell\NormalColor\<language-code>\<etc>

Then try to test a theme with the msstyleEditor again. Maybe Windows now requires to have those files nearby.

@samhoward1991
Copy link

Hi, I'm having the same problem :-(
Tried the %public%/Shell method, but it didn't work for me...

@ZangLucarson
Copy link

tried it too
same error

@TheArkive
Copy link

TheArkive commented Jun 12, 2019

@nptr - I can confirm I'm having the same issue.

file: aero.msstyles (stock Win 10 v1903 - May 2019 update)
issue: clicking "Test" in the menubar results in error msg "Rejected by OS".

If I save the file to my desktop (with modifications) and copy it to the theme folder in Resources then I can load the theme normally in Personalization, and I see it is working. Just doesn't want to test in your program.

EDIT: I get the same issue in WSB. It won't load the default aero.msstyles for testing either.

Maybe it has something to do with a digital signature? Other custom msstyles from other users/themers work and load for testing just fine.

One thing - I can't save and overwrite an msstyles file. Is that intentional? If possible, I'd prefer to be able to overwrite.

Other than that, VERY NICE program! I like the layout much better than in WSB. WSB sometimes gives me a headache. The layout of your program, and the way you explained how classes/parts/properties work was VERY helpful. Any chance you can add a filter, instead of just CTRL+F when searching for classes and parts?

@TheArkive
Copy link

I've been thinking about this issue:

  • 3rd party msstyles load, save, and test fine
  • default msstyles will load and save, but not test
  • 3rd party themes have issues unless the proper patch is applied, like UltraUxThemePatcher, UxStyle, ThemeSignatureBypasser, etc.

Maybe the issue is how you are calling the function to implement the theme? Or as stated before, a resource might be missing. There is a VSCache folder whose contents cannot be copied in the default aero theme folder. I don't need to copy this folder in order to open up the msstyles file and edit it, nor do I need the VSCache folder for applying the theme in Personalization after I've edited it.

It's only when trying to test the theme copied from the default aero.msstyles that this happens.

Maybe if we can identify the exact resource missing, we can remove it from msstyles?

@nptr
Copy link
Owner

nptr commented Jun 16, 2019

One thing - I can't save and overwrite an msstyles file. Is that intentional? If possible, I'd prefer to be able to overwrite.

It was intentional, yes. Technically it was never necessary as far as i remember, but was a convenient and quick fix at the time. I should be able to remove this restriction and provide a more standard save behaviour.

Any chance you can add a filter, instead of just CTRL+F when searching for classes and parts?

Can you specify this in greater detail? A textbox with the filter expression somewhere, that prunes the items in the tree view (left) and propery view (right) ? Or a separate dialog with filter textbox and a list of all found items? Edit: just saw your post on issue #23 with some details. It still would be nice to have your opinion on my two suggestion above. (Lets continue that on #23)

Also, good to hear such a positive feedback, thank you! Also a thank you for sharing your investigation results.

Maybe it has something to do with a digital signature? Other custom msstyles from other users/themers work and load for testing just fine.

Maybe the issue is how you are calling the function to implement the theme?

There is a VSCache folder [..]

I tried to set up a Win10 box for testing a while ago, but it refused to correctly boot in my VMWare VM, and i just let it be. I'll have to try again and dive into this issue, so i don't just make blind guesses. Monitoring the call Win10 does to apply the style is already on my list, as is monitoring the external resources. This VSCache (or caching issues in general) sound interesting too, ill look into it as well.

@dt192
Copy link

dt192 commented Feb 20, 2021

Hi,
I was playing around with this today and noticed a few things...

  • The path you are using is not %public% it's %PUBLIC%\Documents, however adding the shell folder there didn't help.
  • The temp file you are saving has extension .msstyle instead of .msstyles (tmp03460.msstyle)
  • The temporary file is missing the last line of data compared to the file it originates from (seems to be the signature).

Not sure if any of that is relevant, but thought it best to share it just in case it helps.

Also for me, the styles don't get applied when test does function.

OK I did some more testing using autoit to just call on uxtheme.dll directly and found that if I'm calling on .msstyles file that has been saved with your app, it won't load, unless i first patch it with ThemeTool. Once it's patched, the dll will load the theme with no issues.

Weirdly even running Test successfully on a file that Is patched doesn't actually visually apply the style using your app, but running the same file through the dll using autoit does apply it. Here's the code I'm using. I'm able to apply style files from other folders such as Desktop too, as long as they have already been patched after editing.

DllCall("uxtheme.dll", "int", 65, _
        "wstr", "C:\Windows\Resources\Themes\Arc Flatabulous\Arc lm.msstyles", _
        "wstr", "NormalColor", _
        "wstr", "NormalSize", _
        "int", 0)

@nptr
Copy link
Owner

nptr commented Feb 20, 2021

Yes, its indeed %PUBLIC%\Documents, I was writing from memory and erred on on this. But anything in "public" is fine.
You are also right on the file extension. It most likely doesn't matter but its an easy fix.

The signature thing is key information! I suspected something like this but never went deeper.
I was under the impression the signature is embedded somewhere in the resources and Windows would not strip this information when I save the file... How stupid of me to think that :S Windows has to sign & verify the file as a whole so the signature can't be in the regular PE data. And since its not in the regular data, the Resource API didn't care about it. The signature seems to be the last 144 bytes in the file. I'll see how to keep it.

The "Test" feature doesn't work on the original file but a file written by the editor. Even if no modifications were made. The signature is lost just like when saving the file.

Thanks for the hints, much appreciated! :) I'll try to get a release out soon.

@nptr
Copy link
Owner

nptr commented Feb 21, 2021

@dt192
I write a dummy signature now and can apply my theme via ThemeTool without patching.
I can't however apply it via my tool (same method as your script). I also can't apply a theme that was patched
with ThemeTool this way. While I figure out why this works for you but not for me, would you mind testing the latest version of msstyleEditor on your PC?

msstyleEditor1500.zip

nptr added a commit that referenced this issue Feb 21, 2021
@dt192
Copy link

dt192 commented Feb 21, 2021

@nptr
WORKING:

  • Opening a pre signed custom theme from Resources folder and running Test
  • Opening a pre signed custom theme from desktop and running Test
  • Opening a pre signed custom theme, saving it to a new theme, opening the new theme and using Test
  • Open a theme with no signature and running Test
  • Open a theme with no signature, save theme and check with hex editor if signature has been added

NOT WORKING:

  • Applying a windows default theme from resource directory giving OS rejected message
  • Themes reverting on Test stop, in all cases theme stuck

@dt192
Copy link

dt192 commented Feb 21, 2021

OK, just tested again and in all cases themes are now reverting on test end. I'll let you know if I work out why it wasn't working before.

@dt192
Copy link

dt192 commented Feb 21, 2021

I wasn't able to replicate that issue above, so not sure why it wasn't working first time.

I also tested applying a theme signed with your app via ThemeTool and that also worked fine.

Seems all is fine other than applying a windows default theme.

@nptr
Copy link
Owner

nptr commented Feb 22, 2021

Thanks for all your effort, that helps me a lot! (I don't have a Win10 machine where I can easily develop and test on)

I think I know why reverting didn't work. I restored the theme with different flags than used when applying it.
For now I published a pre-release version 1.5.0.0. With it, the errors on restore should not occur.
(It is different than the file you got, despite the version number!)

No idea about the issue with the default theme. I'll track that issue separately in #48.

This was referenced Mar 1, 2021
@nptr nptr closed this as completed Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants