Old 29th July 2014, 12:48   #41
sledgehammer_999
Junior Member
 
Join Date: Jan 2013
Posts: 27
Quote:
Originally Posted by sledgehammer_999 View Post
I opened the produced dll in dependency walker and there isn't a reference to msvcrt.dll in the first level of the dependency tree. (compiled with /MD).

I then compiled it using /MT (statically link the runtime). The filesize increased ~2KB. This means that something is used from the runtime, but why doesn't dependcy walker show the dependency of msvcrt in the /MD compiled dll?



Tried with /Zl and /NODEFAULTLIB but I get the same error.
And I forgot to mention that dependency walker doesn't show any dependency on any msvcrt<versionumber>.dll either.

I also rechecked the filesize difference. It is a ~4KB difference.
I also attach a screeshot of dependecy walker for the /MD compiled dll.
sledgehammer_999 is offline   Reply With Quote
Old 29th July 2014, 13:18   #42
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,914
Quote:
Originally Posted by Afrow UK View Post
My first sentence made this quite clear that this is the case and one way to stop it. I have edited the 2nd sentence for clarity.

Not if you use /NODEFAULTLIB.
/NODEFAULTLIB is a linker flag, how is it going to affect the code generated by the compiler? /Zl should have the same effect.

You cannot include your own memset function either if you are also compiling with /GL.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th July 2014, 13:23   #43
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,914
Quote:
Originally Posted by sledgehammer_999 View Post
I opened the produced dll in dependency walker and there isn't a reference to msvcrt.dll in the first level of the dependency tree. (compiled with /MD).

I then compiled it using /MT (statically link the runtime). The filesize increased ~2KB. This means that something is used from the runtime, but why doesn't dependcy walker show the dependency of msvcrt in the /MD compiled dll?
The compiler might inline the memset call, who knows. Compile with /FAcs and see if there is a memset call and what is generated.

/MT should not increase the filesize (in theory).

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th July 2014, 13:30   #44
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
Originally Posted by Anders View Post
/NODEFAULTLIB is a linker flag, how is it going to affect the code generated by the compiler? /Zl should have the same effect.

You cannot include your own memset function either if you are also compiling with /GL.
LockedList and inetc both use their own memset function instead of the CRT's. This is with /MT, /GL and /Zi. You just have to use /NODEFAULTLIB so it links against your memset instead. Compiled with VS2012 (v110 toolset).

Edit: If you are using Zl (L) for debugging you may as well just link with MSVCRT anyway.

Stu
Afrow UK is offline   Reply With Quote
Old 29th July 2014, 13:35   #45
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,914
Quote:
Originally Posted by Afrow UK View Post
LockedList and inetc both use their own memset function instead of the CRT's. This is with /MT, /GL and /Zi. You just have to use /NODEFAULTLIB so it links against your memset instead. Compiled with VS2012 (v110 toolset).
I know that works sometimes and other times it will give you:

Quote:
...\util.cpp(7) : error C2268: 'memset' is a
compiler predefined library helper. Library helpers are not supported with /GL;
compile object file without /GL.
LINK : fatal error LNK1257: code generation failed

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th July 2014, 15:27   #46
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That error appears to be VS 2005/2008 only. Maybe it pissed too many people off

Stu
Afrow UK is offline   Reply With Quote
Old 29th July 2014, 15:29   #47
sledgehammer_999
Junior Member
 
Join Date: Jan 2013
Posts: 27
If I wrap the MemSet function in this:
code:

#pragma optimize("", off)
void WINAPI MemSet(void*pMem,SIZE_T cb,BYTE set)
{
char *p=(char*)pMem;
while (cb-- > 0){*p++=set;}
// return pMem;
}
#pragma optimize("", on)



A dll is produced with the /Zl switch now. And it is the exact same size as the one produced via /MD. (md5sum shows that they have different contents though).

@Anders, so maybe upload a new version with those pragmas?
sledgehammer_999 is offline   Reply With Quote
Old 29th July 2014, 20:35   #48
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,914
Quote:
Originally Posted by sledgehammer_999 View Post
@Anders, so maybe upload a new version with those pragmas?
I used a different compiler version when I compiled...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th July 2014, 21:09   #49
sledgehammer_999
Junior Member
 
Join Date: Jan 2013
Posts: 27
Would it make sense to wrap the pragma inside ifdef checking the compiler version to the msvc2008 one?

Also I don't think it would hurt if the pragma was used regardless of compiler version...
The uac plugin doesn't need to be overly optimized anyway. We cannot gain much in terms of speed.
sledgehammer_999 is offline   Reply With Quote
Old 22nd October 2018, 06:30   #50
nickdollahz
Junior Member
 
Join Date: Apr 2018
Posts: 8
Exclamation UAC Plugin: UAC_PageElevation_OnInit Page Skip Issues

I am having issues with the UAC Plugin using UAC_PageElevation_OnInit and UAC_PageElevation_OnGuiInit macros.

If I manually skip pages based off a condition using Abort it doesn't actually skip the page in the admin instance. I figured out a workaround but I'm not even sure why the workaround works. (Workaround is to hit the next button on those pages and then Abort. I commented out the code with the workaround)

I have attached a minimal example.
Attached Files
File Type: nsi UACPageSkipInstaller.nsi (4.3 KB, 34 views)
nickdollahz is offline   Reply With Quote
Old 29th October 2018, 13:32   #51
nickdollahz
Junior Member
 
Join Date: Apr 2018
Posts: 8
So noticed UAC Plugin is now labeled deprecated.
Curious what other solutions exist?

Although a lot of people aren't using it for the way I am using it. It seems to serve a purpose for MultiUser Installers. https://github.com/Drizin/NsisMultiUser

I did try and mess around with the source code and compile a debug version. I was able to determine that it is some issue with the Auto Page Jump feature. Unfortunately my C++ skills are non-existent but I do want to learn it eventually. So I have gone away from using it and decided to use the regular UAC Macros. Which means I have to manually skip each page in a pre function.

Everything seems to be working fine. Although I would like to be able to Hide the User instance Window after the admin instance has successfully launched. Not able to figure out how to get the HWND of the original instance.

I have attached an example of calling HideWindow before UAC call, but ideally I would like to call ShowWindow on the HWND of the User instance after the admin instance has been launched successfully.
Attached Files
File Type: nsi UACPageSkipInstallerNoPageMacro.nsi (4.3 KB, 24 views)
nickdollahz is offline   Reply With Quote
Old 29th October 2018, 18:21   #52
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,914
The page jump feature was bolted on later in the development and it might have some bugs because it is a slightly hacky way of doing things.

Manually skipping pages in your code is perfectly fine.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump