Hello! I've written a simple program in order to connect a network drive. WNetAddConnection funcion was used according to Win32 API, but this program doesn't work. It runs, but the drive not connected. Could it tell me someone what's wrong? thank in advance Peter ___________________________________________________ Code .386 .model flat, stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\mpr.inc includelib mpr.lib include \masm32\include\kernel32.inc includelib kernel32.lib include \masm32\include\user32.inc includelib user32.lib .data myNetwork db "\\myServer\myDirectory",0 myDrive db "X:",0 .code start: invoke WNetAddConnection, myNetwork, myDrive, NULL invoke ExitProcess,NULL end start /Code
Posted on 2001-03-22 04:51:00 by Peter.Abraham
Peter, There's a problem with the WNetAddConnection call, it takes 3 parameters:- Remote Name Password Local Driver Letter You've got NULL as your local drive letter, and you're passing the strings incorrectly, try this :-

.data
myNetwork db "\\myServer\myDirectory",0
myDrive db "X:",0

.code
start:
invoke WNetAddConnection, addr myNetwork,NULL , addr myDrive
invoke ExitProcess,NULL 
If you pass NULL as the second Parameter, the password, it uses the default. Umbongo
Posted on 2001-03-22 05:16:00 by umbongo