Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenautodial.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS Winsock 2 SPI 00004 * FILE: lib/mswsock/lib/init.c 00005 * PURPOSE: DLL Initialization 00006 */ 00007 00008 /* INCLUDES ******************************************************************/ 00009 #include "precomp.h" 00010 00011 /* DATA **********************************************************************/ 00012 00013 /* FUNCTIONS *****************************************************************/ 00014 00015 BOOLEAN 00016 WINAPI 00017 AcsHlpSendCommand(IN PAUTODIAL_COMMAND Command) 00018 { 00019 UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"\\Device\\RasAcd"); 00020 NTSTATUS Status; 00021 HANDLE DriverHandle; 00022 HANDLE EventHandle = NULL; 00023 OBJECT_ATTRIBUTES ObjectAttributes; 00024 IO_STATUS_BLOCK IoStatusBlock; 00025 00026 /* Initialize the object attributes */ 00027 InitializeObjectAttributes(&ObjectAttributes, 00028 &DriverName, 00029 OBJ_CASE_INSENSITIVE, 00030 NULL, 00031 NULL); 00032 00033 /* Open a handle to it */ 00034 Status = NtCreateFile(&DriverHandle, 00035 FILE_READ_DATA | FILE_WRITE_DATA, 00036 &ObjectAttributes, 00037 &IoStatusBlock, 00038 NULL, 00039 FILE_ATTRIBUTE_NORMAL, 00040 FILE_SHARE_READ | FILE_SHARE_WRITE, 00041 FILE_OPEN_IF, 00042 0, 00043 NULL, 00044 0); 00045 if (!NT_SUCCESS(Status)) return FALSE; 00046 00047 /* Create an event */ 00048 EventHandle = CreateEvent(NULL, FALSE, FALSE, NULL); 00049 if (!EventHandle) 00050 { 00051 /* Event failed, fail us */ 00052 CloseHandle(DriverHandle); 00053 return FALSE; 00054 } 00055 00056 /* Connect to the driver */ 00057 Status = NtDeviceIoControlFile(DriverHandle, 00058 EventHandle, 00059 NULL, 00060 NULL, 00061 &IoStatusBlock, 00062 IOCTL_ACD_CONNECT_ADDRESS, 00063 Command, 00064 sizeof(AUTODIAL_COMMAND), 00065 NULL, 00066 0); 00067 00068 /* Check if we need to wait */ 00069 if (Status == STATUS_PENDING) 00070 { 00071 /* Wait for the driver */ 00072 Status = WaitForSingleObject(EventHandle, INFINITE); 00073 00074 /* Update status */ 00075 Status = IoStatusBlock.Status; 00076 } 00077 00078 /* Close handles and return */ 00079 CloseHandle(EventHandle); 00080 CloseHandle(DriverHandle); 00081 return NT_SUCCESS(Status); 00082 } 00083 00084 /* 00085 * @implemented 00086 */ 00087 BOOLEAN 00088 WINAPI 00089 AcsHlpAttemptConnection(IN PAUTODIAL_ADDR ConnectionAddress) 00090 { 00091 AUTODIAL_COMMAND Command; 00092 00093 /* Clear the command packet */ 00094 RtlZeroMemory(&Command, sizeof(AUTODIAL_COMMAND)); 00095 00096 /* Copy the address into the command packet */ 00097 RtlCopyMemory(&Command.Address, ConnectionAddress, sizeof(AUTODIAL_ADDR)); 00098 00099 /* Send it to the driver */ 00100 return AcsHlpSendCommand(&Command); 00101 } 00102 00103 /* 00104 * @implemented 00105 */ 00106 BOOLEAN 00107 WINAPI 00108 AcsHlpNoteNewConnection(IN PAUTODIAL_ADDR ConnectionAddress, 00109 IN PAUTODIAL_CONN Connection) 00110 { 00111 AUTODIAL_COMMAND Command; 00112 00113 /* Copy the address into the command packet */ 00114 RtlCopyMemory(&Command.Address, ConnectionAddress, sizeof(AUTODIAL_ADDR)); 00115 00116 /* Set the New Connection flag and copy the connection data */ 00117 Command.NewConnection = TRUE; 00118 RtlCopyMemory(&Command.Connection, Connection, sizeof(AUTODIAL_CONN)); 00119 00120 /* Send it to the driver */ 00121 return AcsHlpSendCommand(&Command); 00122 } 00123 Generated on Sat May 26 2012 04:24:29 for ReactOS by
1.7.6.1
|