in reply to Re^2: Win32 GetEnvironmentVariables?
in thread Win32 GetEnvironmentVariables?

Unless the dll was bound to perl, the changes won't be made until you load the dll. It then depends when the dll sets/changes the environment variables.

If they are set/changed by the dlls initialisation, then you can

use Win32; my $hModule = Win32::Loadibrary( 'thedll' );

to load the library and then use GetEnvironmentStrings or GetEnvironmentVariable (via Win32::API) to get the modified environment for the perl process.

If they don't get set until a particular api within the dll is called, then use Win32::API to load the dll and call the api before retrieving the new/modified values.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: Win32 GetEnvironmentVariables?
by Anonymous Monk on Nov 11, 2006 at 01:49 UTC
    BrowserUK...That's exactley what I was looking for. I'm assuming the Syntax for GetEnvironmentVariable is the same via the Win32 API correct?
    Thanks

      Seems to be.

      use Win32::API::Prototype;; ApiLink( 'kernel32', 'DWORD GetEnvironmentVariable( LPTSTR n, LPTSTR b, DWORD s )' ) or warn $^E;; $buffer = chr( 0 ) x 32767; $chars = GetEnvironmentVariable( 'PROCESSOR_IDENTIFIER', $buffer, 3276 +7 ); print substr $buffer, 0, $chars;; x86 Family 15 Model 2 Stepping 9, GenuineIntel

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.