Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Terry Parkinson
  Where is Terry Parkinson?
 Litchfield
 New Hampshire - United States
 Terry Parkinson
 Tags
Subject: 64 bit W7 and LOGON32
Thread ID: 311193 Message ID: 311193 # Views: 50 # Ratings: 1
Version: Visual FoxPro 9 Category: Operating Systems
Date: Wednesday, June 29, 2011 3:32:39 PM         
   


I'm having trouble using the LOGON32_LOGON_INTERACTIVE routine on a W7 64 bit machine. The logon is used to access files on the server. (full code below--worked for years--thanks Bernard Boul!))
The same program runs well on a W7 32 bit machine, and 10 XP Pro machines.
The problem is that I can't print on the 64 bit machine, either to a local printer or the networked printer. All other parts of the program work on the 64 bit machine, updating files, etc.
GETPRINTER() gives me the printer list on the 64 bit machine, and
lcprinter=alltrim(userstuff.printername)
SET PRINTER TO NAME (lcprinter)
works on all the other machines.
A test program I wrote to just use local files with no server logon on the 64 bit machine can use the printers. The program that logs on to the server cannot use the printers, even if I log on to the machine as administrator.
As far as I can tell, the user rights are established identically on all machines.
Is there something else I should be looking at in terms of rights?
Is there something about this logon routine that won't work fully on a 64 bit machine?

Thanks!
Terry

The printer errors I get are:
error accessing printer spooler
error loading printer driver
(again, other programs on the 64 bit machine use the printers w3ith no issues, as well as the program I wrote to use local files only.)
I've stripped the printer environment from all reports.

LogOn Code
#define LOGON32_PROVIDER_DEFAULT 0
#define LOGON32_LOGON_INTERACTIVE 2
#define LOGON32_LOGON_NETWORK 3
#define LOGON32_LOGON_BATCH 4
#define LOGON32_LOGON_SERVICE 5
#define LOGON32_LOGON_UNLOCK 7

DECLARE integer LogonUser IN AdvApi32.DLL;
string szUsername,;
string lpszDomain,;
string lpszPassword,;
integer dwLogonType,;
integer dwLogonProvider,;
integer @phToken

DECLARE integer ImpersonateLoggedOnUser IN AdvApi32.DLL integer hToken
DECLARE integer RevertToSelf IN AdvApi32.DLL

local nToken
nToken = 0

pth="\\LtServer\Ltnet\Data"
IF LogonUser("SecureAppUser","domainname","password",LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, @nToken) = 0
MESSAGEBOX("Failed to authenticate. Unable to continue",16,"XYZ Corp",0)
QUIT && RETURN
ENDIF
IF ImpersonateLoggedOnUser(nToken) = 0
MESSAGEBOX("Failed to authenticate. Unable to continue",16,"XYZ Corp.",0)
QUIT &&return
ENDIF
SET PATH TO &pth

I

ENTIRE THREAD

64 bit W7 and LOGON32 Posted by Terry Parkinson @ 6/29/2011 3:32:39 PM