| View previous topic :: View next topic |
| Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Dec 07, 2009 8:08 pm Post subject: Windows 7 64Bit - Shortcuts and VDS Code |
|
|
Ok, so I'm using code to shell open a short cut from VDS... Works great until the program that the shortcut refers to is in the "Program Files" directory. No problems if it's in "Program Files (x86)", but wont work at all for "Program Files".
What I get is an error from windows saying it can't find the file in "Program Files (x86)" even though the short cut refers to "Program Files". I believe because VDS is 32 bit that Windows 64 bit instantly translates any calls with the file system to the 32 bit references, which in this case is "Program Files (x86)".
Can anyone confirm this and or think of solution for this?
Thanks in advance,
~Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Mon Dec 07, 2009 10:20 pm Post subject: |
|
|
Have you tried using the %ProgramW6432% or %ProgramFiles% environment variable in your path the shortcut refers to?
BTW - This issue would probably also apply to 64bit XP, Vista, and Server |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Dec 07, 2009 10:39 pm Post subject: |
|
|
I'm not creating the shortcuts via VDS, just launching them. Though, come to think of it, I'm sure I could check to see if I'm running on a 64bit system, and if so, then check the validity of the information from the link, check it against the two paths and if one shows as being true, use that instead. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Dec 08, 2009 2:04 pm Post subject: |
|
|
Take a look at this MS KB on the use of the ShellExecute function which is what the VDS Shell command is using to launch programs http://support.microsoft.com/kb/243378
I suggest you use my VDSShortcut dll to get the target from the Icon first and then use that target in the Shell command just as the article suggests. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Dec 08, 2009 4:22 pm Post subject: |
|
|
Thanks, I'll read that later  _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Dave Heck Valued Newbie

Joined: 02 Mar 2002 Posts: 34 Location: Union, CT USA
|
Posted: Thu Dec 10, 2009 6:39 pm Post subject: Windows 7 64Bit |
|
|
along the same lines - I've been trying to load a couple of .DLL files from the C:\Windows\System32 folder on a Win7 64bit machine - the logged in user is part of the local administrators group and the files exist there.
It will not load them from that folder, however if I put them into a C:\Program Files(x86)\DLLs folder OR a C:\Program Files\DLLs folder they load fine. The same code that fails to load them under 7 64bit works perfectly fine under XP 32bit and 7 32bit....I don't have a XP 64bit machine to test on.
I've also come across an issue with the DSQuery and DSGet commands that Aslan hooked me up with a couple weeks ago. I have that code working fine under 7 32bit, but it will not execute the DSQuery & DSGet commands on the 64bit machines.
I know this doesn't help out much, but just another piece of the puzzle I think....
Dave _________________ Dave Heck
dheck1961@cox.net
Union, Connecticut USA |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Fri Dec 11, 2009 5:56 am Post subject: |
|
|
Dave check this Microsoft KB article: http://msdn.microsoft.com/en-us/library/aa384187(VS.85).aspx
a 32-bit application that attempts to access the System32 directory automatically is redirected to %windir%\SysWOW64.
System32 directory is for 64bit applications/extensions even though its called 'system32', odd yes I know but it's Microsoft...
Try to use %windir%\Sysnative to access the System32 32-bit directory. (this only works on vista 64 and windows 7 64, not on xp 64).
Regarding the dsquery and dsget commands, here are my results:
Windows 7 (32bit and 64bit): neither commands are found using command prompt
Windows Vista (32bit and 64bit): neither commands are found using command prompt
Windows XP (32bit): neither commands are found using command prompt
Windows Server 2008 (32bit and 64bit): neither commands are found using command prompt
Windows Server 2003 (32bit): both work
Windows Server 2000 (32bit): neither commands are found using command prompt
I tested using a default build of Windows for each version of Windows listed above as it's installed and updated with the most recent updates from Windows Update. I suspect there is some missing tools or Active Directory is not enabled thus these commands are not supported. |
|
| Back to top |
|
 |
Dave Heck Valued Newbie

Joined: 02 Mar 2002 Posts: 34 Location: Union, CT USA
|
Posted: Fri Dec 11, 2009 2:02 pm Post subject: Thanks!! |
|
|
I'll give it a read and a try. One thing I did discover is that if I run the dsget|dsquery in a .bat file and add >C:\mygroups.txt to the end the command runs and it will "pipe" it out to a text file which I can then put into my list using the LOADFILE command...clunky, but it does work and since I'm trying to write against 32 and 64bit I may have to leave it this way
dsquery.exe user -samid %username% | dsget.exe user -memberof >C:\mygroups.txt
Do you know if there is any surefire way to detect if the system is running 32 or 64bit? I've poked around in the registry and so far haven't come up with anything solid to key off of. _________________ Dave Heck
dheck1961@cox.net
Union, Connecticut USA |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sat Dec 12, 2009 2:06 pm Post subject: |
|
|
The DS tools from Microsoft are not necessarily distributed with Windows.
You may need to distribute them with your application.
One way to check if 64bit or not might be to check for the directory "%windir%\SysWOW64"
| Code: | If @file(@windir()\SysWOW64,D)
info 64bit
else
info 32bit
end |
|
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Dec 12, 2009 3:41 pm Post subject: |
|
|
Below is a API function to check if your application is running on a 64bit version of Windows.
| Code: |
#-----------------------------------------------------------------------------#
# #
# A function that determines if you are using a 64bit version of windows. #
# #
# Author: Johnny Kinsey #
# #
# Copyright: Copyright © 2007 DragonSphere Software #
# #
#-----------------------------------------------------------------------------#
#DEFINE FUNCTION,WIN64
If @Win64()
Info Your are using a 64bit version of Windows
Else
Info You are using a 32bit version of Windows.
End
Stop
:WIN64
%R =
%%MajorVersion = @SubStr(@SysInfo(WinVer),1,1)
If @Greater(%%MajorVersion,4)
LoadLib kernel32.dll
%B = @BINARY(DWORD,0)
%H = @lib(kernel32,GetCurrentProcess,INT:)
%A = @lib(kernel32,IsWow64Process,BOOL,INT:%H,INT:@addr("%B"))
%B = @val(@substr(%B,1,4))
If @Equal(%B,1)
%R = 1
End
FreeLib kernel32
End
Exit %R
|
Dave your posts are off topic from the initial thread. I believe there are already several threads on the topic of 64bit Windows vs 32bit Windows. This thread is specifically about accessing shortcuts from a system protected folder. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Dec 12, 2009 5:15 pm Post subject: |
|
|
Thanks this will be very useful for what I was working on as well I'm sure others will find a use for this code.  _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
|