Results 1 to 26 of 26

Thread: VB6 Copy File from Server to local Machine

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    2

    VB6 Copy File from Server to local Machine

    Hi all,
    Our client has a requirement in visual basic 6 .for our client they are migrating their visual basic program to new server and in the login screen they copyfile from server to local computer the copy is not working as when we they try to copy file from local computer in different folder its working and only from server copying to local its not working.They are using the Windows Server 2008.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: VB6 Copy File from Server to local Machine

    What method are you using to try and copy the file?
    Does the user have the required permissions to copy files from the server location in question?

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    2

    Re: VB6 Copy File from Server to local Machine

    Hi,
    Thanks for the message,
    Here is the CopyFile code
    dest_path = PATH_ProgramFiles & "\downloadfolder\test.txt"

    sour_path = "\\servername\serverfolder\test.txt"

    Call FileCopy(sour_path, dest_path)

    In Sour_Path if we give the local computer other folder or drive the copy is working only from the server its not working.

    For the server we have already did the folder sharing and we are using the Windows Server 2008.

    Is there any links or videos for server permission setting or checking

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,440

    Re: VB6 Copy File from Server to local Machine

    Yep, sounds more like access-rights to the share on the server
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  5. #5
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    460

    Re: VB6 Copy File from Server to local Machine

    If the share is hidden some of the built in file function don't work. Not sure if filecopy is affected. Hidden shares will have a dollar sign somewhere in the path: \\server\folder$\subfolder

    To test access rights use xcopy from the command line. It will give a better error message

    xcopy "source file path" "dest folder path"

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 Copy File from Server to local Machine

    Hidden share access can be blocked via Policy as well. Relying on hidden shares for production activities is malpractice.

  7. #7
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    460

    Re: VB6 Copy File from Server to local Machine

    Quote Originally Posted by dilettante View Post
    Relying on hidden shares for production activities is malpractice.
    yea, but it happens. And I'm not losing money battling with IT egos

  8. #8
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: VB6 Copy File from Server to local Machine

    Quote Originally Posted by DllHell View Post
    I'm not losing money battling with IT egos
    Oh boy, I've absolutely got to second that one.

    If those guys can figure out how to muck something up, they absolutely will. Some I.T. departments are fantastic, and, I swear, others, it's as if it's their life's purpose to cause problems.

    Here's my latest problem (possibly somewhat related to the OP question). I've got a VB6 compiled EXE that sits on the server. (Okay, keep any negative opinions about that to yourself.) When I do an update to that EXE, I simply have one of my users with full rights to that server folder replace it. Now, first, everyone using it has to get out of it (of course).

    But, I've got one location/hospital where it just won't work. It keeps saying someone is using the EXE. Now, here's more info:
    • This EXE immediately opens a database.
    • Just last week, we had I.T. reboot the server, but they replaced the EXE with a new one.
    • Even after server reboot it doesn't work.
    • I know that nobody else on the network is using the EXE because I can open the database exclusively with another test program.
    • We've had I.T. look at the user's group permissions repeatedly, and they're full access to that folder.


    Personally, I don't take responsibility for these kinds of problems, but it still reflects a bit badly on me. And this kind of problem is not typical.

    I just know that that I.T. department somehow has some setting borked that's causing this problem.

    shanu2018, sorry I've somewhat hijacked your thread, but the solution to this may very well be related to your problem too.

    Y'all Take Care,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  9. #9
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,398

    Re: VB6 Copy File from Server to local Machine

    Elroy -

    It is possible that they have some antivirus/antimalware software that has it open, but not likely.

    You could try placing a test text file at the same location then see if the user can open, modify, save, and replace that file. If not, then IT does indeed have a permission setting wrong for that folder.

  10. #10
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: VB6 Copy File from Server to local Machine

    I'm not at the site anymore, so it's sort of in their hands. It was/is sure a strange one though. Also, I've never completely understood how that "Deny" column on permissions works. I mean, almost all of my users are in half-a-dozen groups or more. What if "Allow" is checked in one group and "Deny" is checked in another? It's just all a big mess to me. And, in that case I outlined in post #8, it might be some antivirus, but we tried it no less than 20 times over a period of about 3 days.

    Each time, we'd just wind up calling I.T. and they'd copy the new file for us, with no permanent resolution for the department head who supposedly had full rights to the folder.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  11. #11
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    460

    Re: VB6 Copy File from Server to local Machine

    elroy -

    File in use error: You can rename files in use. Then put the new exe in the folder. new connections will use the new exe and old connections will use the old one

    Rights: Deny generally always takes precedence over Allow but there are cases where inherited vs explicit come into play (explicit Allow overtakes Inherited Deny). Then you have share permissions too. Windows 10 has a pretty good "effective permissions" tab that helps point to the problem.

  12. #12
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,398

    Re: VB6 Copy File from Server to local Machine

    If the IT personnel can copy the file with no issues, then they have not set up the user with the appropriate rights or permissions to do the same.

  13. #13
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    460

    Re: VB6 Copy File from Server to local Machine

    Quote Originally Posted by jdc2000 View Post
    If the IT personnel can copy the file with no issues, then they have not set up the user with the appropriate rights or permissions to do the same.
    IT is probably killing the filelock and then replacing it https://docs.microsoft.com/en-us/sys...wnloads/handle

  14. #14
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,398

    Re: VB6 Copy File from Server to local Machine

    ... with no issues ...
    If IT is having that issue, they can find out who has the file locked and report that information back.

  15. #15
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    460

    Re: VB6 Copy File from Server to local Machine

    Quote Originally Posted by jdc2000 View Post
    If IT is having that issue, they can find out who has the file locked and report that information back.
    Yeah, they could. But if they just want to update the file, what good is knowing who has it locked? I've seen this exact scenario play out many times and rarely get a reason for why something didn't work. It gets fixed and they move on to the next fire.

  16. #16
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,398

    Re: VB6 Copy File from Server to local Machine

    It you have real IT support, they should be willing to help you get the problem resolved on a permanent basis. If you have Mordac, then you may have to bump the issue up to Mordac's supervisor or someone higher up who can get you the assistance you need.

  17. #17
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: VB6 Copy File from Server to local Machine

    Well, since you guys seem interested, here are some other really strange clues:

    Yeah, sometimes we'd delete the file (EXE), and then copy the new EXE into the folder. However, and here's where things get really strange. When we'd do that, and then execute it, it'd be the old version. After doing that, we figured out that, when we deleted the EXE, it'd be gone from that explorer's view. However, if we refreshed the explorer, the file would come back. And all of that would happen without any notices of any kind.

    And DllHell ...

    Quote Originally Posted by DllHell View Post
    Rights: Deny generally always takes precedence over Allow but there are cases where inherited vs explicit come into play (explicit Allow overtakes Inherited Deny). Then you have share permissions too. Windows 10 has a pretty good "effective permissions" tab that helps point to the problem.
    ... the twistedness of that sentence is specifically why I try to always leave those things to the I.T. guys. But then, they're often not smart enough to get it sorted either.

    And jdc2000 ...

    Quote Originally Posted by jdc2000 View Post
    If the IT personnel can copy the file with no issues, then they have not set up the user with the appropriate rights or permissions to do the same.
    ... I'm fairly certain all the I.T. guys at each facility have administrative server rights on all the local servers. And that's not true of department heads.

    Someday maybe I'll learn all the in's and out's of NT permissions, but probably not. I just know they can get twisted up.

    And guys, I'm truly not on-site at that facility again until July, so I'm really not worried about it.

    But shanu2018, just know that strange things can happen when you get all kinds of strange permissions on servers.

    All The Best,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  18. #18
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,398

    Re: VB6 Copy File from Server to local Machine

    The IT guys are getting paid to know how to set up user permissions properly. That is what they should be doing, not just updating it themselves and calling it good.

  19. #19
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: VB6 Copy File from Server to local Machine

    Quote Originally Posted by jdc2000 View Post
    The IT guys are getting paid to know how to set up user permissions properly. That is what they should be doing, not just updating it themselves and calling it good.
    Ohhh, believe me, I know. But I'm not their boss. In fact, as a consultant, I really don't even have that much influence over them. I've been around this hospital system for over 20 years, so I know people, but that's just typically not a battle worth fighting. That "pick your battles" thing. Also, the department heads know it's not on me. They'll eventually work it out.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  20. #20
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 Copy File from Server to local Machine

    you know a dedicated DB Server wouldn't have issues with file rights... just saying

  21. #21
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    460

    Re: VB6 Copy File from Server to local Machine

    Quote Originally Posted by DEXWERX View Post
    you know a dedicated DB Server wouldn't have issues with file rights... just saying
    MSSQL has over 200 different permissions, 20 odd fixed roles and numerous implied relationships. It makes NTFS looks like childs play. If you have a printer capable of print 5 feet across, you can print a readable copy: https://www.red-gate.com/blog/audit-...er-permissions LOL

  22. #22
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 Copy File from Server to local Machine

    Quote Originally Posted by DllHell View Post
    MSSQL has over 200 different permissions, 20 odd fixed roles and numerous implied relationships. It makes NTFS looks like childs play. If you have a printer capable of print 5 feet across, you can print a readable copy: https://www.red-gate.com/blog/audit-...er-permissions LOL
    I guess I miss your point, or possibly you missed mine which was directed at Elroy.
    Given the couple years I've been dealing with these issues, difficult IT depts and file share problems,
    I've always had much better luck using a dedicated DB Server.

    Basically permission issues went from constant support (monthly), to none.

    Are you implying that because MSSQL has overly complicated permissions, that you'll have less issues with a network share and NTFS?

    maybe this isn't an appropriate discussion for the OP.
    Last edited by DEXWERX; Apr 27th, 2018 at 11:12 AM.

  23. #23
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    460

    Re: VB6 Copy File from Server to local Machine

    He is operating in a hospital and would likely never get permission to install or manage his own server.
    Last edited by DllHell; Apr 27th, 2018 at 11:39 AM.

  24. #24
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 Copy File from Server to local Machine

    I can't imagine that stuffing arbitrary things into a database just to make it easy to get away with it is going to pass the sniff test once a security audit discovers it. Could even be grounds for instant dismissal if this is in a hospital since the regulations covering health care data systems are quite strict.

    "I was trying to get around security" isn't much of a defense.

  25. #25
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: VB6 Copy File from Server to local Machine

    I agree, I see how my post is ambiguous given the OP.

    I'm only recommending using a Database to store shared data, instead of an MS Access file.

    As for getting around share security for files - In the past I've used a web service to do this. It's easy to make it pass any regulatory compliance, especially if you piggy back off LDAP.

  26. #26
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 Copy File from Server to local Machine

    If this is important I'm not sure why the problem couldn't be escalated until he gets the assistance he needs.

    The problem with box jockeys is that they come in all shapes and sizes, from the rare craftsman to the more common high school dropout gamer corporate officer's sister's kid who was sent to a certificate cram course hoping that he might move out of the basement some day. When there is a trouble ticket the cannon fodder are always on the front line.

    If this is some unsanctioned side project your boss is winking at you are sort of screwed. As soon as you try to escalate the problem eyebrows may be raised at whatever fabrications are being used to try to make the stealth IT operation look legit. Then you and your boss might both get reprimanded or canned, or at best have your user rights scaled back and your PCs scraped of any development software.

    The boss in such a scenario is probably fully aware of its implications and won't back you up. So you might potentially end up out the door to try your hand at flipping burgers or working the checkout desk at the public library again.

    Things could be worse. A lot of stuff is on the books these days as cybercrimes, and that includes a lot of stealth IT. It's all fun and games until someone gets a felony conviction.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width