Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP9:read data from table on LAN computer 1

Status
Not open for further replies.

Eliott

Programmer
Nov 8, 2009
91
BA
I have to redesign small project inside small LAN (10 PC under WinXP Pro and Windows 7) with app based on VFP9. Old solution was that compiled VFP app (EXE) was on most powerfully PC together with tables and other files in common folder called appfolder. I made it shared & free for changes and on next 4 PC I made shortcuts on desktop (\\mainserver\appfolder\starter.exe) to EXE and it worked fine. But on LAN connected another few computers & users which shall not be allowed to use this app nor to see contents of this folder. I thought about creating Guest account on "server" PC and putting password by using Win XP ability. I did it, created profile Guest on "server" PC that worked for login purpose but I wasn't able to access to this folder from others PC even I know password. In dialog that appeared (Connect to Mainserver) I saw Username: \Mainserver\Guest and in field bellow I put password for Guest but not accepted!? Why? How?
I wish to put VFP compiled app (EXE) on all 4 PC and to make this app to be able to read data from tables which are in password protected folder on PC called Mainserver. I tried some plays with API calls but unable to comply. Earlier, without password secured folder I put inside app:
Code:
road="\\Mainserver\appfolder"
SET PATH TO (road)
SET DEFAULT TO (road)
and it was able to read data w/o problem. How to achieve same effect with password protected folder? Thanks in advance.

There is no good nor evil, just decisions and consequences.
 
"How to achieve same effect with password protected folder?"

If this 'password protected folder" contains data tables, then why would you have its access limited by a password?

FULL Access rights to your data folders should be allowed for all users in the User Group containing the VFP application users.

Good Luck,
JRB-Bldr
 
Hi jrbbldr,
if I leave classic shared folder on server PC then it could be seen & accessed by other users on LAN, to delete files or make some other damage. I thought to protect this folder by putting password so that VFP-app access to this folder by submitting password reserved for Guest on server PC. Issues are as follows:
1) after I put password for Guest on server PC I restarted it and after that shared folder isn't accessible! It appears small dialog where I put password for Guest but won't grant me to folder!
2) same thing happened when I tried it from VFP
3) after removing password for Guest all works normally
Maybe Policy editor shall be configured manually?
Thanks for response.

There is no good nor evil, just decisions and consequences.
 
"if I leave classic shared folder on server PC then it could be seen & accessed by other users on LAN"

Not if you or your network administrator limits that folder's security access to the User Group which contains the list of VFP Application users.

Good Luck,
JRB-Bldr
 
Suggestion for you (After you get the password issues solved)

In my experience (Best practice) having multiple copies of the exe on multiple computer may lead to issues, such as when upgrading having to run around and upgrade each computer can be a hassle. (You one can write an auto updater but that IMO has its own issues. )

What I do and suggest is to write a very small ‘Loader’ app whose job it is look in the dir for all EXEs and start up the most recent. This way I can drop a new EXE into the folder and the next time the user starts up via the loader the most recent exe is run. (Also rolling back a version is easy I just delete the current on, thou I have to admit the users do need to exit the app to do that. Maybe I could use a utility program to change the exe’s file date/time hmmm… ) Yes you could change the loader slightly to copy the EXE from the network folder to the local drive if you want; still I like the idea of having only one exe on the network.

I realize that having only one EXE is a professional opinion not the absolute only right way of doing it.


Lion Crest Software Services
Anthony L. Testi
President
 
Not if you or your network administrator limits that folder's security access to the User Group which contains the list of VFP Application users.

Hi JRB-Bldr, thanks you stopped by... let's suppose that admin limited access to folder with tables on so called server; what to put in VFP-app in order to read data from mentioned folder, how to send username and password that WinXP expect before grant access? I tried already API calls by using this code (don't know for sure author) but w/o success:
Code:
CLEAR
#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
? "-------------"
? LogonUser("username","domain","password",LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, @nToken)
* Access will be granted, you are accessing the dbf as domain\user
CLOSE DATABASES all
USE "\\mainserver\appfolder\tableone.dbf"
BROWSE
? RevertToSelf()
*  Now access will be denied, you are accessing the dbf as the currently user logged on at the computer's console.
I replaced username with name of user created on server and password with password that belongs them, but nothing. Zero. Ah yes, I don't use domain, I use workgroup rather in LAN.
Thanks again for your valuable reply.

There is no good nor evil, just decisions and consequences.
 
"let's suppose that admin limited access to folder with tables on so called server; what to put in VFP-app in order to read data from mentioned folder, how to send username and password that WinXP expect before grant access?"

None of that is needed. The OS will 'recognize' the users with their own login to the Domain at their workstation.
Then, assuming that the network access has been set up properly, through that individual user 'recognition' and the User Group they have been assigned to, the network OS will allow un-fettered access to the data folder - no additional username, passwords, etc. are needed.

From that point the application need only USE the data tables in the normal manner.

Code:
cDataDir = "F:\VFP\Data"
cDBF = ADDBS(cDataDir) + "MyTable.dbf"
USE (cDBF) IN 0
SELECT MyTable
<do whatever>

And I agree with MrDataGuy in that you should either have a single installation of the VFP EXE on the server and use a 'launcher' when the individual users want to launch the application. A good one is: faq184-4492

Good Luck,
JRB-Bldr
 
Hi jrbbldr,
thank you for your answer with additional explanation that support your view of solution. I'll try it today and post result of exam.
Thank you very much.

There is no good nor evil, just decisions and consequences.
 
SOLVED:
Well jrbbldr, it's working. On "server" I disabled Simple file sharing and made proper restriction for folder. I got what I needed. You deserved a big
T H A N K Y O U
for your explanation that leaded me to solution. No hard coding, just a few smart clicks in Control panel. God bless you.

There is no good nor evil, just decisions and consequences.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top