reilly1
April 6th, 1999, 01:29 PM
The ability to connect to a Windows NT system at the IPC$ share with no
user name or password is normal. Functions like "Redbutton" and the
(net use \\10.1.1.1\ipc$ "" /user:"") do this normally. The function
"NetUseAdd()" allows you to make connections to the IPC$ share.
However, when you run this program it takes the user ID and password
from the client NT system and uses that to connect to the host NT
system. This is when you specify no user ID or password. When you do
give it a password and user ID it will connect as normal. I need to
figure out how to bypass the default gathering of user ID and password
in the function in order to pass "true" null information. Any help is appreciated.
--------------------------------------------------------------------------------------
#include <windows.h>
#include <lm.h>
#include <stdio.h>
#include <stdlib.h>
#pragma hdrstop
#define MAXLEN 256
int main(int argc, char *argv[])
{
// set the structure (use_info_2)
USE_INFO_2 u;
// set netuseadd and error checking variables
DWORD rc, error=0;
// define server variable
wchar_t server[MAXLEN];
mbstowcs(server, argv[1], MAXLEN);
memset( &u, '\0', sizeof u);
//fill in the USER_INFO_2 for connection infor
u.ui2_local = NULL;
u.ui2_remote = (char *) server;
u.ui2_password = (char *)L''; //specify no password
u.ui2_username = (char *)L''; // specify no username
u.ui2_domainname = (char *)L''; //specify no domainname
u.ui2_asg_type = USE_IPC;
// value checking in the structure
printf("%S\n",u.ui2_remote);
printf("%S\n",u.ui2_username);
printf("%S\n",u.ui2_password);
// make the connection
rc = NetUseAdd( NULL, 1, (byte *) &u, &error);
// check for errors (see win32 api error file)
if (rc != ERROR_SUCCESS)
printf("Netuseadd() returned %lu (arge# = %lu)\n", rc, error);
return 0;
}
user name or password is normal. Functions like "Redbutton" and the
(net use \\10.1.1.1\ipc$ "" /user:"") do this normally. The function
"NetUseAdd()" allows you to make connections to the IPC$ share.
However, when you run this program it takes the user ID and password
from the client NT system and uses that to connect to the host NT
system. This is when you specify no user ID or password. When you do
give it a password and user ID it will connect as normal. I need to
figure out how to bypass the default gathering of user ID and password
in the function in order to pass "true" null information. Any help is appreciated.
--------------------------------------------------------------------------------------
#include <windows.h>
#include <lm.h>
#include <stdio.h>
#include <stdlib.h>
#pragma hdrstop
#define MAXLEN 256
int main(int argc, char *argv[])
{
// set the structure (use_info_2)
USE_INFO_2 u;
// set netuseadd and error checking variables
DWORD rc, error=0;
// define server variable
wchar_t server[MAXLEN];
mbstowcs(server, argv[1], MAXLEN);
memset( &u, '\0', sizeof u);
//fill in the USER_INFO_2 for connection infor
u.ui2_local = NULL;
u.ui2_remote = (char *) server;
u.ui2_password = (char *)L''; //specify no password
u.ui2_username = (char *)L''; // specify no username
u.ui2_domainname = (char *)L''; //specify no domainname
u.ui2_asg_type = USE_IPC;
// value checking in the structure
printf("%S\n",u.ui2_remote);
printf("%S\n",u.ui2_username);
printf("%S\n",u.ui2_password);
// make the connection
rc = NetUseAdd( NULL, 1, (byte *) &u, &error);
// check for errors (see win32 api error file)
if (rc != ERROR_SUCCESS)
printf("Netuseadd() returned %lu (arge# = %lu)\n", rc, error);
return 0;
}