How to Access a Peer machine on same LAN network

187 views
Skip to first unread message

Mel Smith

unread,
Dec 9, 2021, 12:05:09 PM12/9/21
to
Hi All:
Is there a Harbour way to access the directories of a peer machine on the same local LAN Network.

(and yes, I know I can start up batch files to try to do this, but is there any other way ? )

So, using a harbour proggie, I'd like to copy files from my dev machine to another machine on my local network.

Thanks,

-Mel

dlzc

unread,
Dec 9, 2021, 12:20:58 PM12/9/21
to
Dear Mel:

On Thursday, December 9, 2021 at 10:05:09 AM UTC-7, meds...@gmail.com wrote:
> Hi All:
> Is there a Harbour way to access the directories of a peer
> machine on the same local LAN Network.

Is there a mapped drive, or are you going to use UNC?

> (and yes, I know I can start up batch files to try to do this,
> but is there any other way ? )
>
> So, using a harbour proggie, I'd like to copy files from my dev
> machine to another machine on my local network.

You could do RUN, and give it source and destination information (like in a batch file).

Pretty sure we've implemented filecopy():
https://www.itlnet.net/programming/program/Reference/tools1-3/ng959a3.html
... might be slower, but you could get error status back if it did not work.

David A. Smith

Mel Smith

unread,
Dec 9, 2021, 12:44:26 PM12/9/21
to
Hi David:
It is a mapped drive J: to the root of the peer:
(i.e., net use J: \\lenovo\C /persistent:yes)
I can 'RUN' the batch files, but whatever I do (after weeks of trying different schemes), I still get 'Access Denied'
However, if I turn sideways to this little peer ( aWin 7 Pro laptop), and work on it, I can access my dev machine with no problem !!
That is, on the peer Win 7 machine, I can do the following:
c:\>copy i:\anydamnthingIwant.xxx /v
or: c:\del j:crap.txt
These things I can do we gay abandon --- at the command line !

So, with my brilliant mind, I thought: why not create a little proggie that tries to sneak around the crazy 'Access Denied' and see if a Harbour program can copy files to directories on my Win 7 machine. (also, the Win 7 machine has all the proper 'Share' settings changed and modified incessantly over the past two months.

So, what I 've been doing (since my dev crash last April is 'pullling files' rather tha 'pushing them' from dev to peer.

Thanks for your comments. So, I guess I'll try to use the following xharbour command:

filecopy("c:\somedevdir\mydevfile.xxx","j:\somejdir\mydevfile.xxx)

Your further comments are welcome and Thanks

-Mel

Dan

unread,
Dec 9, 2021, 6:41:38 PM12/9/21
to
Il 09/12/2021 18:44, Mel Smith ha scritto:

> It is a mapped drive J: to the root of the peer:
> (i.e., net use J: \\lenovo\C /persistent:yes)
> I can 'RUN' the batch files, but whatever I do (after weeks of trying different schemes), I still get 'Access Denied'
It seems a permission problem. Try to set the directory you want to
access writable by NETWORK USERS.

I guess the program does not impersonate the owner/user (you) of that
directory, maybe is auto started by system?...

Dan

Mel Smith

unread,
Dec 9, 2021, 10:32:46 PM12/9/21
to
Hi Dan:
As you can see above, I want to be able to access the root drive of C *and* all its sub-directories.
I was able to do this for *years* with no problem, then after a Win 10 crash in late April, and a subsequent rebuild /update of my Win 10 dev machine, I was unable to 'push' files to my little peer any more.

On my Win 7peer, I give access to *everybody* with read/write/delete options for *all*. I even hired a geek2you guy who came over to my place, and worked for an hour finally saying "you can't do that !" . So, I said I'd been doing it for *years*. He left with $100 of my money.

Also, I've been researching the use of the hidden drive: C$ Yeah, a dollar sign. A mapping using this C$ designation is 'supposed to' allow access to a C: drive on a peer target machine which has a user with the same username and password as on the base machine. And I have the identical name and password on both machines. And, of course, both usernames are Administrators. Can't make that work either.

Mel Smith

unread,
Dec 9, 2021, 11:50:57 PM12/9/21
to
Hi All:
I created and ran the proggie, but failed to fool the operating system :(
Thanks all
-Mel

kenny.ooi

unread,
Dec 9, 2021, 11:57:44 PM12/9/21
to
hi med ,you can try this ...
filecopy("c:\somedevdir\mydevfile.xxx","\\networkname\somejdir\mydevfile.xxx") or
__run( " copy c:\somedevdir\mydevfile.xxx \\networkname\somejdir\mydevfile.xxx" )


dlzc

unread,
Dec 10, 2021, 9:00:29 AM12/10/21
to
Hello Mel:

On Thursday, December 9, 2021 at 9:50:57 PM UTC-7, meds...@gmail.com wrote:
> Hi All:
> I created and ran the proggie, but failed to fool the operating system :(

Micro$haft has deprecated doing ANYTHING in the root of the C drive, for decades. They want you to do everything under the User account, which means you should be doing everything under the User account OR a separate data drive.

It is so much easier to ride the horse in the direction it is going.

Can you invoke administrative rights on the batch file? Can you code it as a .CMD file (calls up CMD.EXE), rather than a .BAT file (calls up COMMAND.COM)? Remember, the virus writers love the older DOS interface, because it had significant vulnerabilities. And Users that demand DOS-like commands, require that Micro$haft leave their fly open a little bit...

Not sure if our RUN command invokes COMMAND.COM or CMD.EXE.

David A. Smith

Jayadev U

unread,
Dec 10, 2021, 9:13:53 AM12/10/21
to
Hi Mel,

There can be multiple reasons for "Access Denied Message". Please try
out the following, one by one.

1. Ensure File Sharing is enabled for the Network Adapter.
2. Disable fire-wall temporarily on both the machines and check.
3. Change the Network Profile to "Private" for the Network Adapter in
use in both the machines.
4. Create a same user in both machine with Admin rights and check.
5. For Win 10 and Win 7 machines to communicate, in File sharing option
of Network, change the password encryption from 128 to 40/56 and see or
if it is at 40/56 change to 128.
6. Antivirus (QuickHeal for example) will not allow file copy/write
unless both the Network profile is set to 'Work' or 'Home' (Default is
'Public') IRRESPECTIVE OF SETTINGS IN NETWORK ADAPTER.

If these do not solve your problem, send me an email and I will try and
help you.

Please understand that this is only a permission issue and you cannot
"By-pass" the same through program.

Warm regards,

Jayadev



Mel Smith

unread,
Dec 10, 2021, 12:30:34 PM12/10/21
to
Hi Jayadev:

I'm going thru your steps one-by-one.
But, I don't have any firewall active on either machine, and certainly File Sharing and Advanced File sharing are active on both machines.
I have already turned off all 'Public' Sharing on both machines.
The encryption has always been set to 128 on both machines. Should I change to 128 on both ??
I have set both machines to "home".
I'll puzzle a bit more before slamming my head on the desk :(
Thanks !
-Mel

Mel Smith

unread,
Dec 10, 2021, 2:01:57 PM12/10/21
to
Hi All:
Here's my little proggie below

#INCLUDE "C:\MGW\SOURCE\INCLUDE2.CH"

FUNCTION Main()
local i,j
local cJdrv,nJdrvtype,nKdrvtype
local lGotJ,lGotK
local cSrc,cDST,nBytes
local nOSERR,nHBERR

cJdrv := "J:"
cKdrv := "K:"
cSrc := "c:\download\somecrap.txt"
cDst := "c:\download\loadofcrap.txt"
cNetDst := "j:\download\loadofcrap.txt"
cls

// now test if J:drive exists
lGotJ := isdisk(left(cJdrv,1))
if .not. lGotJ
alert("No SUCH Drive J. Start network and try again.")
quit
endif
?
? "Drive J exists"
?
// Now test if its a network drive
nJdrvtype := drivetype(left(cJdrv,1))

if nJdrvtype <> 5
alert(" Drive J: is NOT a network Drive")
quit
endif
? "Drive Type of J: is "+ntoc(nJdrvtype)
?

// Try to pass a file from C: to C: first
nBytes := filecopy(cSrc,cDst)
alert("Number of bytes passed is: " + ntoc(nBytes))
// Response above was 2678 bypres passed

// Now Try to pass a file from C: to J: now
nBytes := filecopy(cSrc,cNetDst)
// Respinse above was 0 bytes passed
nOSErr := HB_OSERROR()
nHBERR := FERROR()
if nbytes == 0
alert("Operation Failed. No Bytes Copied. Err1 Code = "+ NTOC(nOSERR)+" Err2 Code = "+NTOC(nHBERR))
// response above was 0 bytes passed, and both error codes showed 0 as the code !

quit
endif
alert("Number of bytes passed is: " + ntoc(nBytes))
alert("Quit Now")

return nil

dlzc

unread,
Dec 10, 2021, 2:16:10 PM12/10/21
to
And which message are you getting? Because I don't have your network architecture, mine is all Win10...

Which is Win7, the "C" or the "J"?

Can you have the machine with the "J" drive reach out and copy the "C" drive on the remote machine? Maybe have the "C" machine compare the two files... to make sure backup is occurring.

David A. Smith

Mel Smith

unread,
Dec 10, 2021, 3:26:10 PM12/10/21
to
Hi David:
The C machine is my development machine. The J machine is my Win 7 machine (and is the machine on which all three of my web sites reside.
AsI noted before, on my J machine, I can easily access the C develpment machine and 'PULL' files over from C. But, I *don't want to * ! For years I've been PUSHING them to my little Win 7 machine. And then, months ago I lost this convenience. and I want it back.

As an example, I was used to doing the following to send a new 1st page for one of my sites to my win 7 machine:
(after editing the 1st page or menu or whatever for one of my sites_

C:\MEP\>SEND MEPINDEX (where SEND is a batch file containing commands for copying the mepindex.htm to various places)
and quick as a whistle, the new page would be available for display when users would visit my site.

Yes, the J machine can and does reach out. Indeed the J machine (my web site machine) can easily read/write/edit/delete files on the C machine.
My worry is that my 'slowly failing' C machine may crash, and a replacement Win 10 machine will no longer be accessible from the J machine.
If that becomes reality, then I'm totally screwed.

Right now, I'm totally dependent on 'pulling' files, and I'm frightened !

-Mel

Ella Stern

unread,
Dec 10, 2021, 5:56:18 PM12/10/21
to
If I remember well, not even the plain local executables are permitted to write a file directly into the "root" of a disc (in C:\ etc.)
I'd try to create a test folder, and I'd configure it for sharing (it shouldn't be inside your web-enabled folder tree).
Just thinking out loud...

Dan

unread,
Dec 10, 2021, 6:37:30 PM12/10/21
to
Il 10/12/2021 18:30, Mel Smith ha scritto:

> I'll puzzle a bit more before slamming my head on the desk :(
> Thanks !
> -Mel
>
Mel, that thing that someone suggested about the "C:\" path being
treated by Windows >=10 as a forbidden territory lit some neurons in my
brain. I think I have heard something similar in the past.

A kind of "security policy" the Microsoft way, the kind of thing you
hear and you try to forget a moment later, as too insane... :-)

Dan

Mel Smith

unread,
Dec 10, 2021, 8:20:30 PM12/10/21
to
Hi Ella:
I just made a quickie change to my proggie, and wrote that loadofcrap file to the root of my C: drive.
-Mel

Mel Smith

unread,
Dec 10, 2021, 8:24:37 PM12/10/21
to
Hi Dan:
I agree.
Its *my* machine right beside me, and now it seems like sn lien device :((
However, that little *alien, can easily access my Win 10 machine and do anything it wants. The most important thing now is I can 'pull' files because I can't push them any more.
It seems weird that my Win 7 is more powerful than my Win 10
-Mel

dlzc

unread,
Dec 13, 2021, 9:15:48 AM12/13/21
to
Dear Mel:

On Friday, December 10, 2021 at 6:24:37 PM UTC-7, meds...@gmail.com wrote:
...
> It seems weird that my Win 7 is more powerful than my Win 10

Not weighing in one way or the other, but "more powerful" is also "more insecure". If a virus can write to the root of a remote computer, it can spread viruses. Fatally damage the OS.

I had a ransomware attack on a Linux-box network drive, that targeted AutoCAD DWG files. One of the "bosses" responded to an email in a way he shouldn't have. These "virus" writers are smart, and will do whatever they can, whatever the platform lets them get away with. Mel, your "fly is open" on one machine, and you are complaining you cannot "feel the draft" on the other.

David A. Smith

Mel Smith

unread,
Dec 13, 2021, 11:11:51 AM12/13/21
to
Hi All:
I have a way of getting older versions of Windows 10 (and am creating a version right now on a USB from September of 2020)..

Question: Does anyone know *which* older version of windows allows writing to the root drive of a peer machine ??

If I knew this, then I can easily get that version and overwrite my current version wit this older version ?

Thanks,

-Mel

(and to David -- yes, I'm aware of the risks but I really have to try this !)

Ella Stern

unread,
Dec 13, 2021, 6:48:07 PM12/13/21
to
I consider that the solution described in the below article IS A VERY BAD PRACTICE:
https://www.wintips.org/fix-cannot-save-create-files-on-root-drive-c-in-windows-8-1-windows-7/


Mel Smith

unread,
Dec 13, 2021, 9:50:34 PM12/13/21
to
HI Ella:
Thank you for this regedit possible solution.
It may be bad practice but it was my work for 8 years without a problem.
btw, I can't even write to *sub-directories* on my little Win 7 machine. Get 'access denied' of course.

So first, I'll try your solution on the Win 7 machine and see what happens

Please not that my little Win 7 machine has total control over my Win 10 development machine, and can read/write/edit/delete any file I choose.
I would like the *reverse* to be true. !
Thanks again for a possible solution
(I'll let
-Mel

Mel Smith

unread,
Dec 13, 2021, 11:05:36 PM12/13/21
to
Hi Ella:
Well I et the UAC setting to 0 in both machines, and I still get 'access denied' .
But thank you for the suggestion .
-Mel

Enrico Maria Giordano

unread,
Dec 14, 2021, 3:50:19 AM12/14/21
to
Il 14/12/2021 00:48, Ella Stern ha scritto:

> I consider that the solution described in the below article IS A VERY BAD PRACTICE:
> https://www.wintips.org/fix-cannot-save-create-files-on-root-drive-c-in-windows-8-1-windows-7/

I agree!

EMG

http://www.emagsoftware.it
http://www.emagsoftware.it/emgmusic
http://www.emagsoftware.it/spectrum
http://www.emagsoftware.it/tbosg

Enrico Maria Giordano

unread,
Dec 14, 2021, 3:52:05 AM12/14/21
to
Il 14/12/2021 05:05, Mel Smith ha scritto:

> Well I et the UAC setting to 0 in both machines, and I still get 'access denied' .

Did you restart both PC?

Mel Smith

unread,
Dec 14, 2021, 1:16:29 PM12/14/21
to
Yes, It was a forced option anyway.
Still no joy, and am resigned to not accessing my little win 7 machine from Win 10.
I've gone over several additional 'fixes' from different people around the world who wish to do the same as me.
One guy uses his older Win 7 machine as a backup machine. Then, after a Win 10 upgrade, he was no longer able to back up from his Win 10 to his Win 7 on his LAN.
Almost the identical problem I have !
I followed his 'fix' (very long and laborious), but it didn't work for me.
The problem here is most (or all ?) of you have no working and active Win 7 machine on your local LAN with a Win 10 peer machine.
And therefore you are not able to confirm the reality of your suggestions.
btw, my Win 7 machine is Win 7 Pro. Version 6.1.7601, Build 7601
Anyway, thank you all for thoughts
Like a turtle, I'll now pull my head inside my shell for awhile.

-Mel

Jayadev U

unread,
Dec 16, 2021, 8:22:56 AM12/16/21
to
Hi Mel,

I still maintain there is some permission issue or such other.

I have multiple networks with Win 10 and Win 7 communicating with each
other without any problem. Initially, of course, I also faced many
problems but were eventually solved.

Warm regards,

Jayadev

Mel Smith

unread,
Dec 16, 2021, 5:19:23 PM12/16/21
to
Hi Jayadev:
Thank you for your (private) offer this morning.
I am able to access with full access rights just *one* folder on my win 7 machine (c:\amyuni).

I would like to know how this particular sub-directory (amyuni)is easily accessible, but others are not.

I have visited amyuni->properties->security->permissions, and noted that the permissions 'seem' the same as at least two other folders.
I can read and copy files from the Win 7 c:\users\ sub-dir, but cannot copy file *to* the Win 7 c:\users\ folder (access denied)/

Thanks again for your offer. If there is some 'permission' steps you can suggest, I'll try them.

Frustrating !.

-Mel


Mel Smith

unread,
Dec 16, 2021, 6:37:04 PM12/16/21
to
Hi Jayadev:
it is now working !!
I was adding permission to everyone in C:\ rather than the network C Shared drive. Wow What a revelation.
Thanks for your support.
-Mel

Enrico Maria Giordano

unread,
Dec 17, 2021, 3:51:03 AM12/17/21
to
Il 17/12/2021 00:37, Mel Smith ha scritto:

> it is now working !!
> I was adding permission to everyone in C:\ rather than the network C Shared drive. Wow What a revelation.

Great!
Message has been deleted

Rick Lipkin

unread,
Dec 22, 2021, 9:25:26 AM12/22/21
to
Enrico

YES .. agreed, you must add the group Everyone with rights to your share .... just curious why you have to map a drive .. when you can use a UNC instead ??

Use( "\\sales\myapp\Customer.dbf" ) ... where the shared computer name is \\Sales and the shared folder is \myapp

Rick Lipkin

dlzc

unread,
Dec 22, 2021, 10:09:27 AM12/22/21
to
Dear Rick Lipkin:

On Wednesday, December 22, 2021 at 7:25:26 AM UTC-7, Rick Lipkin wrote:

I am not Enrico, but...

> ... just curious why you have to map a drive .. when you can use a UNC instead ??
>
> Use( "\\sales\myapp\Customer.dbf" ) ... where the shared computer name
> is \\Sales and the shared folder is \myapp

Drive mapping under earlier version of Windoze, produced faster search results (at minimum). May or may not still be an issue in Windows 10.
<https://superuser.com/questions/1628244/what-are-the-benefits-of-windows-map-network-drive>
... and there have been cases when the UNC path was faster (Server 2016 for example).

I periodically have to have a replacement "server" running (eg: \\sales AND \\sales2) at the same time during transitions, and if you map a drive, then you don't have to touch your code as often when that happens. Whatever server you've mapped your drive to, is the one the code talks to.

David A. Smith

Mel Smith

unread,
Dec 22, 2021, 10:28:33 AM12/22/21
to
Hi David:
I agree, and also I have many batch files where I use the mapped J: drive which is 'Persistent'. Works great now.
-Mel
Reply all
Reply to author
Forward
0 new messages