ReactOS  0.4.14-dev-49-gfb4591c
autodial.c File Reference
#include "precomp.h"
#include <ndk/iofuncs.h>
#include <ndk/rtltypes.h>
Include dependency graph for autodial.c:

Go to the source code of this file.

Functions

BOOLEAN WINAPI AcsHlpSendCommand (IN PAUTODIAL_COMMAND Command)
 
BOOLEAN WINAPI AcsHlpAttemptConnection (IN PAUTODIAL_ADDR ConnectionAddress)
 
BOOLEAN WINAPI AcsHlpNoteNewConnection (IN PAUTODIAL_ADDR ConnectionAddress, IN PAUTODIAL_CONN Connection)
 

Function Documentation

◆ AcsHlpAttemptConnection()

BOOLEAN WINAPI AcsHlpAttemptConnection ( IN PAUTODIAL_ADDR  ConnectionAddress)

Definition at line 89 of file autodial.c.

90 {
92 
93  /* Clear the command packet */
95 
96  /* Copy the address into the command packet */
97  RtlCopyMemory(&Command.Address, ConnectionAddress, sizeof(AUTODIAL_ADDR));
98 
99  /* Send it to the driver */
100  return AcsHlpSendCommand(&Command);
101 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
Definition: shell.h:41
struct Command Command
BOOLEAN WINAPI AcsHlpSendCommand(IN PAUTODIAL_COMMAND Command)
Definition: autodial.c:17
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

Referenced by WSAttemptAutodialAddr(), and WSAttemptAutodialName().

◆ AcsHlpNoteNewConnection()

BOOLEAN WINAPI AcsHlpNoteNewConnection ( IN PAUTODIAL_ADDR  ConnectionAddress,
IN PAUTODIAL_CONN  Connection 
)

Definition at line 108 of file autodial.c.

110 {
112 
113  /* Copy the address into the command packet */
114  RtlCopyMemory(&Command.Address, ConnectionAddress, sizeof(AUTODIAL_ADDR));
115 
116  /* Set the New Connection flag and copy the connection data */
117  Command.NewConnection = TRUE;
118  RtlCopyMemory(&Command.Connection, Connection, sizeof(AUTODIAL_CONN));
119 
120  /* Send it to the driver */
121  return AcsHlpSendCommand(&Command);
122 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
Definition: shell.h:41
struct Command Command
BOOLEAN WINAPI AcsHlpSendCommand(IN PAUTODIAL_COMMAND Command)
Definition: autodial.c:17

Referenced by WSNoteSuccessfulHostentLookup().

◆ AcsHlpSendCommand()

BOOLEAN WINAPI AcsHlpSendCommand ( IN PAUTODIAL_COMMAND  Command)

Definition at line 17 of file autodial.c.

18 {
19  UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"\\Device\\RasAcd");
21  HANDLE DriverHandle;
25 
26  /* Initialize the object attributes */
28  &DriverName,
30  NULL,
31  NULL);
32 
33  /* Open a handle to it */
34  Status = NtCreateFile(&DriverHandle,
38  NULL,
42  0,
43  NULL,
44  0);
45  if (!NT_SUCCESS(Status)) return FALSE;
46 
47  /* Create an event */
49  if (!EventHandle)
50  {
51  /* Event failed, fail us */
52  CloseHandle(DriverHandle);
53  return FALSE;
54  }
55 
56  /* Connect to the driver */
57  Status = NtDeviceIoControlFile(DriverHandle,
59  NULL,
60  NULL,
63  Command,
64  sizeof(AUTODIAL_COMMAND),
65  NULL,
66  0);
67 
68  /* Check if we need to wait */
69  if (Status == STATUS_PENDING)
70  {
71  /* Wait for the driver */
73 
74  /* Update status */
76  }
77 
78  /* Close handles and return */
80  CloseHandle(DriverHandle);
81  return NT_SUCCESS(Status);
82 }
#define CreateEvent
Definition: winbase.h:3565
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define CloseHandle
Definition: compat.h:398
#define FILE_OPEN_IF
Definition: from_kernel.h:56
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
Definition: shell.h:41
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FILE_READ_DATA
Definition: nt_native.h:628
smooth NULL
Definition: ftsmooth.c:416
#define FILE_WRITE_DATA
Definition: nt_native.h:631
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define INFINITE
Definition: serial.h:102
#define IOCTL_ACD_CONNECT_ADDRESS
Definition: precomp.h:34
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:855

Referenced by AcsHlpAttemptConnection(), and AcsHlpNoteNewConnection().