Re: Unbelieveable code, it produces one result in VB6 run and another if compiled in a exe file ???? What gives ???

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Feb 15, 1:07 pm, "Vinchenzo vinç" <Vinç@newsgroup.nospam> wrote:
"viglen" <AlexandriaSupp...@xxxxxxxxx> escribió en el mensaje de noticiasnews:17d719ea-2013-4ae5-ac2e-b16d0fa775e2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Feb 14, 10:18 pm, "Robert" <rob...@xxxxxxxxxxx> wrote:

Just ran the code in VB6 SP5 on WinXP Pro.

From IDE and also from the created EXE

I get the exact same serial number.

Robert

I dont get it, how come I don't.

We'll here, let me add the obvious difference is that I run VB6 SP6
and Windows VISTA , could that be it ? But even if it is, why
different results at VB runtime and EXE runtime of the same exact
code ?

    Hi,
    the difference it is not between the IDE and the EXE file, you are
launching the IDE and the EXE in a different security context, your are
using different tokens to query the Win32_PhysicalMedia information, the IDE
have inherited Administrative privileges, and the EXE from the Explorer have
a token with the least privilege and access rights from the Users Group. In
Windows XP you will get similar problems, you can test your code under an
Administrator account, and the EXE launched on a Limited User account
retrieves garbage or empty results.

    Try to launch the EXE explicitly "As Administrator" from Windows
Explorer and you will obtain the same results as in the IDE.

--
    Regards
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
( ! )http://groups.google.com/group/microsoft.public.vb.general.discussion
( i )http://www.microsoft.com/communities/conduct/default.mspx
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Thank you Vinchenzo, you got it right , that was the problem !!!
Thank you all guys for all of your effort !
Thank you.
.



Relevant Pages