elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


  Mostrar Temas
Páginas: 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [28] 29 30 31 32 33 34 35
271  Programación / .NET (C#, VB.NET, ASP) / SerialPort y Modem ? en: 27 Enero 2013, 23:43 pm
Lo que espero es un Ok del Modem mas recibo un 65 alguna idea, quizas sea por el tipo de lectura que estoy haciendo....Salu2

Disculpen por repetir el Topic si pudieran borrar el otro estaria agradecido...gracias

Código
  1.  
  2. Imports System.IO.Ports
  3.  
  4. Public Class Form1
  5.  
  6.    Private mySerialPort As New SerialPort
  7.    Private comBuffer As Byte()
  8.    Private Delegate Sub UpdateFormDelegate()
  9.    Private UpdateFormDelegate1 As UpdateFormDelegate
  10.  
  11.    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  12.        Try
  13.            AddHandler mySerialPort.DataReceived, AddressOf mySerialPort_DataReceived
  14.            CommPortSetup()
  15.        Catch ex As Exception
  16.            MessageBox.Show(ex.Message)
  17.        End Try
  18.    End Sub
  19.  
  20.    Private Sub mySerialPort_DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
  21.        'Handles serial port data received events
  22.        UpdateFormDelegate1 = New UpdateFormDelegate(AddressOf UpdateDisplay)
  23.        Dim n As Integer = mySerialPort.BytesToRead 'find number of bytes in buf
  24.        comBuffer = New Byte(n - 1) {} 're dimension storage buffer
  25.        mySerialPort.Read(comBuffer, 0, n) 'read data from the buffer
  26.  
  27.        Me.Invoke(UpdateFormDelegate1) 'call the delegate
  28.    End Sub
  29.  
  30.    Private Sub UpdateDisplay()
  31.        Label2.Text = CStr(comBuffer(0))
  32.    End Sub
  33.  
  34.    Private Sub CommPortSetup()
  35.        With mySerialPort
  36.            .PortName = "COM3"
  37.            .BaudRate = 9600
  38.            .DataBits = 8
  39.            .Parity = Parity.None
  40.            .StopBits = StopBits.One
  41.            .Handshake = Handshake.None
  42.        End With
  43.        Try
  44.            mySerialPort.Open()
  45.        Catch ex As Exception
  46.            MessageBox.Show(ex.Message)
  47.        End Try
  48.    End Sub
  49.  
  50.    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  51.        mySerialPort.WriteLine("AT+VCID")
  52.    End Sub
  53. End Class
  54.  
  55.  
272  Programación / .NET (C#, VB.NET, ASP) / Trabajando con Puerto COM - SerialPort !! Dudita ! en: 24 Enero 2013, 01:18 am
holas estoy tratando de leer la respuesta del Modem al comando que le paso y me devuelve un numero, no entiendo porque quizas sea en el tipo de lectura que se hace que es con un buffer....

Alguna idea...Lo que espero es un OK

Código
  1. Imports System.IO.Ports
  2.  
  3. Public Class Form1
  4.  
  5.    Private mySerialPort As New SerialPort
  6.    Private comBuffer As Byte()
  7.    Private Delegate Sub UpdateFormDelegate()
  8.    Private UpdateFormDelegate1 As UpdateFormDelegate
  9.  
  10.    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  11.        Try
  12.            AddHandler mySerialPort.DataReceived, AddressOf mySerialPort_DataReceived
  13.            CommPortSetup()
  14.        Catch ex As Exception
  15.            MessageBox.Show(ex.Message)
  16.        End Try
  17.    End Sub
  18.  
  19.    Private Sub mySerialPort_DataReceived(ByVal sender As Object, ByVal e As SerialDataReceivedEventArgs)
  20.        'Handles serial port data received events
  21.        UpdateFormDelegate1 = New UpdateFormDelegate(AddressOf UpdateDisplay)
  22.        Dim n As Integer = mySerialPort.BytesToRead 'find number of bytes in buf
  23.        comBuffer = New Byte(n - 1) {} 're dimension storage buffer
  24.        mySerialPort.Read(comBuffer, 0, n) 'read data from the buffer
  25.  
  26.        Me.Invoke(UpdateFormDelegate1) 'call the delegate
  27.    End Sub
  28.  
  29.    Private Sub UpdateDisplay()
  30.        Label2.Text = CStr(comBuffer(0))
  31.    End Sub
  32.  
  33.    Private Sub CommPortSetup()
  34.        With mySerialPort
  35.            .PortName = "COM3"
  36.            .BaudRate = 9600
  37.            .DataBits = 8
  38.            .Parity = Parity.None
  39.            .StopBits = StopBits.One
  40.            .Handshake = Handshake.None
  41.        End With
  42.        Try
  43.            mySerialPort.Open()
  44.        Catch ex As Exception
  45.            MessageBox.Show(ex.Message)
  46.        End Try
  47.    End Sub
  48.  
  49.    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  50.        mySerialPort.WriteLine("AT+VCID")
  51.    End Sub
  52. End Class
  53.  
273  Programación / .NET (C#, VB.NET, ASP) / Necesito consultar la fecha en Internet ?? en: 14 Enero 2013, 03:53 am
Holas chikos quizas alguno tenga algun codigo sobre consultar con algun server la fecha, es que el que tengo no me gusta...

Lo que hago es consultar una web y buscar en ella la fecha...

Se que hay un protocolo que atiende eso el NTP pero no encuentro un proyecto que me funcione sin problemas...

Salu2 y gracias cualquier idea...
274  Programación / .NET (C#, VB.NET, ASP) / Problemilla con Sqlite !! en: 19 Diciembre 2012, 17:23 pm
Hola chicos tengo una aplicación donde estoy sacando informacion de una BD Sqlite y la estoy mostrando en una DataGrid sin problemas, la cuestion es que necesito una ves que termine mis modificaciones salvar los datos y no encuentro como, estuve mirando un ejemplo pero me da un error.. aqui les dejo el link... gracias cualquier sugerencia...

http://sqlite.phxsoftware.com/forums/p/2291/9199.aspx

Salu2
275  Foros Generales / Dudas Generales / Como puedo conectar el microfono y los speaker del Pc a la linea telefonica ? en: 15 Diciembre 2012, 02:07 am
Es para poder llamar a alguien usando el modem y una ves que contesten, si yo por ejemplo reproduzco una cancion ellos la puedan oir, sin problemas...y si ellos dicen algo yo poderlos oir por los speaker....

Un colega lo tiene se que funciona....

Salu2
276  Programación / Programación C/C++ / Ayuda para usar este proyecto !! en: 14 Diciembre 2012, 20:41 pm
chicos bueno este codigo según de donde lo saque dice que se encuentra en y cito

The code sample below in located in "YourPlatformSDKPath"\Samples\NetDS\RRas\Adminapi\, extra libaries and includes are needed (as I guess).


Necesito pasarlo para .Net es posible ?? Gracias.....

/******************************************************************************
*    This is a part of the Microsoft Source Code Samples.
*    Copyright (C) 1992 - 2002 Microsoft Corporation.
*    All rights reserved.
*    This sample source code is only intended as a supplement to
*    MprAdmin API usage and is meant to help users with the
*    MprAdmin API calling convention. Use this code at your own risk.
*    Microsoft disclaims any implied warranty. This sample code can
*    be copied and distributed.

******************************************************************************/
 
/********************************************************************
* admapit.c -- Sample program demonstrating the use of different
*           MprAdmin API
*
* Comments:
*
* This program expects \\Servername as its arguments.
*
* MprAdminGetErrorString API returns error string. However
* this API may return an Error 87 (Invalid Parameter) for the non
* RAS error codes. This API is designed for only RAS related error codes.
* For more Info. check the documentation. I am using this API for all the
* errors but I print the error codes before calling this API
*
*****************************************************************************/
/***************************************************************************
* Functions:
*   Init2(void);
*   Init1(void);
*   PrintGetStringError(DWORD dwResult);
*   UserPrivilege(WCHAR *DomainName, WCHAR *UserName);
*   PrintPriv(WCHAR *DomainName, WCHAR *UserName);
*   PrintClearStats(WCHAR * RasSrv, WCHAR *wszPortName);
*   WINAPI RasAdminClearDisc(LPVOID param);
*   IsServiceRunning(WCHAR *RasSrv);
*   Debug_Print_Connection0(RAS_CONNECTION_0 *pRasConnection0);
*   Debug_Print_Connection1(RAS_CONNECTION_1 *pRasConnection1);
*   Debug_Print_RAS_PORT0(RAS_PORT_0 *pRasPort0);
*   Debug_Print_RAS_PORT1(RAS_PORT_1 *pRasPort1);
*   File_Print_Connection0(RAS_CONNECTION_0 *pRasConnection0);
*   File_Print_Connection1(RAS_CONNECTION_1 *pRasConnection1);
*   File_Print_RAS_PORT0(RAS_PORT_0 *pRasPort0);
*   File_Print_RAS_PORT1(RAS_PORT_1 *pRasPort1);
*   ProcPortClearStat(HANDLE hPort);
*   ProcConnectionClearStat(HANDLE hConnection);
*   ProcPortReset(HANDLE hPort);
*   ProcPortDisconnect(HANDLE hPort);
*   ProcConnectionGetInfo(HANDLE hConnection);
*   ProcPortGetInfo(HANDLE hPort);
*****************************************************************************/

#define sleeptime 10000

#include <windows.h>

#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <lm.h>
#include <stdio.h>
#include <time.h>
#include <ctype.h>
#include <conio.h>
#include <mprapi.h>
#include <memory.h>

#include <tchar.h>
#include "Shlwapi.h" // Platform SDK wasn't including this .h file so it's part of this project

// Macro for counting maximum characters that will fit into a null terminated buffer
#define CELEMS(x) ( ((sizeof(x))/(sizeof(x[0]))) - 1)

// Macro for writing to logfile
#define WRITE_LOG_FILE(LogFile, szbuf, len, pdwBytesWritten, flag) {\
  if ((LogFile)!=INVALID_HANDLE_VALUE) \
   WriteFile((LogFile), (szBuf), (len), (pdwBytesWritten), (flag)); \
}



//Function Definitions
VOID Init2(void);
VOID Init1(void);
VOID PrintGetStringError(DWORD dwResult);
VOID UserPrivilege(WCHAR *DomainName, WCHAR *UserName);
VOID PrintPriv(WCHAR *DomainName, WCHAR *UserName);
VOID PrintClearStats(WCHAR * RasSrv, WCHAR *wszPortName);
DWORD WINAPI RasAdminClearDisc(LPVOID param);
INT IsServiceRunning(WCHAR *RasSrv);
VOID Debug_Print_Connection0(RAS_CONNECTION_0 *pRasConnection0);
VOID Debug_Print_Connection1(RAS_CONNECTION_1 *pRasConnection1);
VOID Debug_Print_RAS_PORT0(RAS_PORT_0 *pRasPort0);
VOID Debug_Print_RAS_PORT1(RAS_PORT_1 *pRasPort1);
VOID File_Print_Connection0(RAS_CONNECTION_0 *pRasConnection0);
VOID File_Print_Connection1(RAS_CONNECTION_1 *pRasConnection1);
VOID File_Print_RAS_PORT0(RAS_PORT_0 *pRasPort0);
VOID File_Print_RAS_PORT1(RAS_PORT_1 *pRasPort1);
VOID ProcPortClearStat(HANDLE hPort);
VOID ProcConnectionClearStat(HANDLE hConnection);
VOID ProcPortReset(HANDLE hPort);
VOID ProcPortDisconnect(HANDLE hPort);
VOID ProcConnectionGetInfo(HANDLE hConnection);
VOID ProcPortGetInfo(HANDLE hPort);


// Global Variables
WCHAR*
StrDupWFromA(
  CHAR* psz );


#define Number_Of_Flags 6

HANDLE LogFile = NULL;
HANDLE cLogFile = NULL;
HANDLE ErrLogFile = NULL;

CHAR buf[120];
WCHAR CallbackNumber[255];
BOOL First_Call = TRUE;
DWORD Status = 0;
DWORD dwResult = 0;
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
BOOL ErrLogInValid = FALSE;
BOOL cErrLogInValid = FALSE;
BOOL LogInValid = TRUE;
BOOL FirstCall = TRUE;
WCHAR szUserAccountServer[UNLEN+1];
PRAS_USER_0 ppRasUser0;
RAS_USER_0 RasUser0;
WCHAR lpszServerName[50];
WCHAR RasSrv[64];
BOOL Quit=FALSE;

RAS_SERVER_HANDLE phRasServer;


// Function Starts
WCHAR*
StrDupWFromA(
  CHAR* psz )

  /* Returns heap block containing a copy of 0-terminated string 'psz' or
  ** NULL on error or if 'psz' is NULL. The output string is converted to
  ** UNICODE. It is caller's responsibility to Free the returned string.
  */
{
  WCHAR* pszNew = NULL;

  if (psz)
  {
   DWORD cb;

   cb = MultiByteToWideChar( CP_ACP, 0, psz, -1, NULL, 0 );

   pszNew = malloc( cb * sizeof(WCHAR) );
   if (!pszNew)
   {
     return NULL;
   }

   cb = MultiByteToWideChar( CP_ACP, 0, psz, -1, pszNew, cb );
   if (cb == 0 && strlen(psz)!=0)
   {
     free( pszNew );
     return NULL;
   }
  }
  return pszNew;
}


//
// Format and write debug information to OutputDebugString
//
ULONG
_cdecl
DbgPrint(
  PCH Format,
  ...
  )
{
  WCHAR buffer[255];
  WCHAR *temp = NULL;
  LPINT lpResult=NULL;
  va_list marker;
  va_start (marker,Format);

  temp = StrDupWFromA(Format);
  if (temp)
  {
    wvnsprintfW(buffer, CELEMS(buffer), temp, marker);
    OutputDebugString (buffer);
    free(temp);
  }

  return TRUE;
}

//
// Init Functions to setup logfiles
//

VOID Init1(void )
{
  //Store port information in this file
  LogInValid = FALSE;
  LogFile = CreateFile(TEXT("Admin.log"),
            GENERIC_READ|GENERIC_WRITE,
            FILE_SHARE_READ,
            (LPSECURITY_ATTRIBUTES) NULL,
            CREATE_ALWAYS,
            0,
            (HANDLE) NULL);

  if (LogFile== INVALID_HANDLE_VALUE)
  {
   LogInValid = TRUE;
  }

}


VOID Init2(void)
{
  cErrLogInValid = FALSE;
  ErrLogInValid = FALSE;
  //Stores Statistics and port disconnect information in this file
  cLogFile = CreateFile(TEXT("AdminStats.log"),
             GENERIC_READ|GENERIC_WRITE,
             FILE_SHARE_READ,
             (LPSECURITY_ATTRIBUTES) NULL,
             CREATE_ALWAYS,
             0,
             (HANDLE) NULL);
  if (cLogFile== INVALID_HANDLE_VALUE)
  {
   cErrLogInValid = TRUE;
  }

  //Stores user privilege information in this file
  ErrLogFile = CreateFile(TEXT("AdminUser.log"),
              GENERIC_READ|GENERIC_WRITE,
              FILE_SHARE_READ,
              (LPSECURITY_ATTRIBUTES) NULL,
              CREATE_ALWAYS,
              0,
              (HANDLE) NULL);

  if (ErrLogFile== INVALID_HANDLE_VALUE)
  {
   ErrLogInValid = TRUE;
  }

}


//
// Function to print error strings
//
VOID PrintGetStringError(DWORD dwResult)
{
CHAR szBuf[120];
DWORD dwBytesWritten = 0;

  DbgPrint("ERROR MprAdminGetErrorString   %d\n",dwResult);
  wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminGetErrorString   %d\n",dwResult);
  WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
}


//
// Function to see if the service running
//
INT IsServiceRunning(WCHAR *RasSrv)
{
DWORD dwResult;
CHAR szBuf[120];
DWORD dwBytesWritten = 0;

  //Calling MprAdminIsServiceRunning
  // Parameters:
  // IN LPWSTR  * RasSrv
  dwResult = MprAdminIsServiceRunning(RasSrv);
  //printf("Ras server: %s\n", *RasSrv);
  if (dwResult==TRUE)
  {
   DbgPrint("Ras AND Router Serivce running on the Server\n");
   wnsprintfA(szBuf, CELEMS(szBuf), "Ras AND Router Serivce running on the Server\n");
   WriteFile(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   //Calling MprAdminServerConnect
   // Parameters
   // IN LPWSTR  * RasSrv
   // OUT RAS_SERVER_HANDLE * phRasServer
   dwResult = MprAdminServerConnect(RasSrv, &phRasServer);
   if (dwResult != NO_ERROR)
   {
     DbgPrint("Failed to Connect to Server\n");
     wnsprintfA(szBuf, CELEMS(szBuf), "Failed to Connect to Server: ERROR %d\n", dwResult);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
     return 0;
   }
  }
  else
  {
   DbgPrint("Ras AND Router Serivce is NOT running on the Server\n");
   wnsprintfA(szBuf, CELEMS(szBuf), "Ras AND Router Serivce is NOT running on the Server: ERROR %d\n", dwResult);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   return 0;
  }
  return 1;
}


//
// Function to print user privileges to logfile
//
VOID PrintPriv(WCHAR *DomainName, WCHAR *UserName)
{
DWORD dwBytesWritten = 0;
CHAR szBuf[120];

   /*********** from mprapi.h ****************************************************/
   //
   // Note: Bit 0 MUST represent NoCallback due to a quirk of the "userparms"
   //    storage method. When a new LAN Manager user is created, bit 0 of the
   //    userparms field is set to 1 and all other bits are 0. These bits are
   //    arranged so this "no Dial-In info" state maps to the "default Dial-In
   //    privilege" state.
   //
   // #define RASPRIV_NoCallback    0x01
   // #define RASPRIV_AdminSetCallback 0x02
   // #define RASPRIV_CallerSetCallback 0x04
   // #define RASPRIV_DialinPrivilege  0x08
   //
   // #define RASPRIV_CallbackType (RASPRIV_AdminSetCallback \
   //               | RASPRIV_CallerSetCallback \
   //               | RASPRIV_NoCallback)
   /*****************************************************************************/

   wnsprintfA(szBuf, CELEMS(szBuf), "\nDomainName = %ws\nUserName = %ws\n",DomainName, UserName);
   WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

   wnsprintfA(szBuf, CELEMS(szBuf), "ppRasUser0->bfPrivilege = 0x%x\n",ppRasUser0->bfPrivilege);
   WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

   //
   // display the privilege flags
   //
   if ((ppRasUser0->bfPrivilege) & (RASPRIV_NoCallback))
   {
    wnsprintfA(szBuf, CELEMS(szBuf), "\t\tRASPRIV_NoCallback    = 0x%x\n", (ppRasUser0->bfPrivilege & (RASPRIV_NoCallback)));
    WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   if ((ppRasUser0->bfPrivilege) & (RASPRIV_AdminSetCallback))
   {
    wnsprintfA(szBuf, CELEMS(szBuf), "\t\tRASPRIV_AdminSetCallback = 0x%x\n", (ppRasUser0->bfPrivilege & (RASPRIV_AdminSetCallback)));
    WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   if ((ppRasUser0->bfPrivilege) & (RASPRIV_CallerSetCallback))
   {
    wnsprintfA(szBuf, CELEMS(szBuf), "\t\tRASPRIV_CallerSetCallback = 0x%x\n", (ppRasUser0->bfPrivilege & (RASPRIV_CallerSetCallback)));
    WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   if ((ppRasUser0->bfPrivilege) & (RASPRIV_DialinPrivilege))
   {
    wnsprintfA(szBuf, CELEMS(szBuf), "\t\tRASPRIV_DialinPrivilege  = 0x%x\n", (ppRasUser0->bfPrivilege & (RASPRIV_DialinPrivilege)));
    WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
}


//
// Function to get and change User Dialin Privileges.
// It goes through all the Dialin Privileges for a user.
//
VOID UserPrivilege(WCHAR *DomainName, WCHAR *UserName)
{
DWORD dwResult;
CHAR szBuf[120];
DWORD dwBytesWritten = 0;
WCHAR Buf[512];
WCHAR *lpszString;
static BYTE Dialin = 9;
lpszString = &Buf[0];
ppRasUser0 = &RasUser0;

  // API Called:   MprAdminGetPDCServer
  // Parameters:
  // IN WCHAR * lpwsDomainName
  // IN WCHAR * lpwsServerName
  // OUT WCHAR * lpwsPDCServer


  dwResult = MprAdminGetPDCServer(DomainName, NULL, &szUserAccountServer[0]);

  if (dwResult != NO_ERROR)
  { 
   dwResult = MprAdminGetPDCServer(NULL, RasSrv, &szUserAccountServer[0]);
  }

  if (dwResult == NO_ERROR)
  {
   // API Called:   MprAdminUserGetInfo
   // Parameters:
   // IN WCHAR * lpwsServerName
   // IN WCHAR * lpwsUserName
   // IN DWORD dwLevel
   // OUT LPBYTE *lpbBuffer
   dwResult = MprAdminUserGetInfo(szUserAccountServer, UserName,(DWORD) 0, (LPBYTE) ppRasUser0);
   if (dwResult != NO_ERROR)
   {
     wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminUserGetInfo   %d\n",dwResult);
     WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
     wnsprintfA(szBuf, CELEMS(szBuf), "Parameters in:\n\tlpszServer=%ws\n\tlpszUser=%ws\n\tdwLevel=0,\n\tlpbBuffer)\n",
            szUserAccountServer, UserName);
     WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

     dwResult = MprAdminGetErrorString( dwResult, &lpszString);
     if (dwResult == NO_ERROR)
     {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminUserGetInfo: string from MprAdminGetErrorString: %ws\n",lpszString);
      WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
     }
     else
      PrintGetStringError(dwResult);
   }
   else //MprAdminUserGetInfo returned success
   {
     ppRasUser0->bfPrivilege = (RASPRIV_DialinPrivilege | Dialin );
     wcsncpy(ppRasUser0->wszPhoneNumber, CallbackNumber,
        sizeof(ppRasUser0->wszPhoneNumber)/sizeof(ppRasUser0->wszPhoneNumber[0]));
     // API Called:   MprAdminUserSetInfo
     // Parameters:
     // IN WCHAR * lpwsServerName
     // IN WCHAR * lpwsUserName
     // IN DWORD dwLevel
     // IN LPBYTE lpbBuffer
     dwResult = MprAdminUserSetInfo(szUserAccountServer, UserName, 0, (LPBYTE)ppRasUser0);
     if (dwResult != NO_ERROR)
     {
      wnsprintfA(szBuf, CELEMS(szBuf), "ERROR: MprAdminUserSetInfo   %d\n",dwResult);
      WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

      wnsprintfA(szBuf, CELEMS(szBuf), "Parameters in:\n\tlpszServer=%ws\n\tlpszUser=%ws\n\tdwLevel=0,\n\tlpbBuffer)\n",
              szUserAccountServer, UserName);
      WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      // dump this out to see what privileges were passed in UserSetInfo call
      PrintPriv(szUserAccountServer, UserName);

      dwResult = MprAdminGetErrorString( dwResult, &lpszString);
      if (dwResult == ERROR_SUCCESS)
      {
        wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminUserSetInfo: string from MprAdminGetErrorString: %ws\n",lpszString);
        WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      }
      else
        PrintGetStringError(dwResult);
     }
     else
     {
      PrintPriv(szUserAccountServer, UserName);
     }
         
   
     //
     // cycle thru these Callback privilege values
     //
     // Dialin = 9 : No Callback
     // Dialin = 10: Admin Sets Callback Number
     // Dialin = 12: Caller Sets Callback Number
     switch (Dialin)
     {
      case 9:
        Dialin = 10;
        break;
      case 10:
        Dialin = 12;
        break;
      case 12:
        Dialin = 9;
        break;
      default:
        break;
     }

   
   } // end of loop for MprAdminUserGetInfo returning success

  }
  else //MprAdminGetPDCServer returned an error
  {
   DbgPrint("ERROR MprAdminGetPDCServer   %d\n",dwResult);
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminGetPDCServer   %d\n",dwResult);
   WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   wnsprintfA(szBuf, CELEMS(szBuf), "Parameters in:\n\tlpszDomain=%ws\n\tlpszServer=NULL\n", DomainName);
   WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);

   dwResult = MprAdminGetErrorString(dwResult, &lpszString);
   if (dwResult == NO_ERROR)
   {
     wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminGetPDCServer   %ws\n",lpszString);
     WRITE_LOG_FILE(ErrLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }

} //end UserPrivilege()



//
// dump connection0 struct to debug output
//
VOID Debug_Print_Connection0(RAS_CONNECTION_0 *pRasConnection0)
{
  WCHAR *Interface_Type[] =
  {
  L"ROUTER_IF_TYPE_CLIENT",
  L"ROUTER_IF_TYPE_HOME_ROUTER",
  L"ROUTER_IF_TYPE_FULL_ROUTER",
  L"ROUTER_IF_TYPE_DEDICATED",
  L"ROUTER_IF_TYPE_INTERNAL",
  L"ROUTER_IF_TYPE_INTERNAL"
  };

  //dumping pRasConnection0
  DbgPrint("pRasConnection0->hConnection 0x%x\n",pRasConnection0->hConnection);
  DbgPrint("pRasConnection0->hInterface  0x%x\n",pRasConnection0->hInterface);
  DbgPrint("pRasConnection0->dwConnectDuration %d\n",pRasConnection0->dwConnectDuration);
  DbgPrint("pRasConnection0->dwInterfaceType %ws\n",Interface_Type[pRasConnection0->dwInterfaceType]);
  DbgPrint("pRasConnection0->dwConnectionFlags %d\n",pRasConnection0->dwConnectionFlags);
  DbgPrint("pRasConnection0->wszInterfaceName %ws\n",pRasConnection0->wszInterfaceName);
  DbgPrint("pRasConnection0->wszUserName %ws\n",pRasConnection0->wszUserName);
  DbgPrint("pRasConnection0->wszLogonDomain %ws\n",pRasConnection0->wszLogonDomain);
  DbgPrint("pRasConnection0->wszRemoteComputer %ws\n",pRasConnection0->wszRemoteComputer);

 

 
}


//
// dump connection1 struct to debug output
//
VOID Debug_Print_Connection1(RAS_CONNECTION_1 *pRasConnection1)
{
  //dumping pRasConnection1
  DbgPrint( "\n\npRasConnection1->hConnection 0x%x\n",pRasConnection1->hConnection);
  DbgPrint( "pRasConnection1->hInterface  0x%x\n",pRasConnection1->hInterface);
  DbgPrint( "pRasConnection1->PppInfo.nbf.dwError %d\n",pRasConnection1->PppInfo.nbf.dwError);
  DbgPrint( "pRasConnection1->PppInfo.nbf.wszWksta %ws\n",pRasConnection1->PppInfo.nbf.wszWksta);
  DbgPrint( "pRasConnection1->PppInfo.ip.dwError %d\n",pRasConnection1->PppInfo.ip.dwError);
  DbgPrint( "pRasConnection1->PppInfo.ip.wszAddress %ws\n",pRasConnection1->PppInfo.ip.wszAddress);
  DbgPrint( "pRasConnection1->PppInfo.ip.wszRemoteAddress %ws\n",pRasConnection1->PppInfo.ip.wszRemoteAddress);
  DbgPrint( "pRasConnection1->PppInfo.ipx.dwError %d\n",pRasConnection1->PppInfo.ipx.dwError);
  DbgPrint( "pRasConnection1->PppInfo.ipx.wszAddress %ws\n",pRasConnection1->PppInfo.ipx.wszAddress);
  DbgPrint( "pRasConnection1->PppInfo.at.dwError %d\n",pRasConnection1->PppInfo.at.dwError );
  DbgPrint( "pRasConnection1->PppInfo.at.wszAddress %ws\n",pRasConnection1->PppInfo.at.wszAddress);
 
  //connection stats
  DbgPrint( "pRasConnection1->dwBytesXmited=%d\n", pRasConnection1->dwBytesXmited );
  DbgPrint( "pRasConnection1->dwBytesRcved=%d\n", pRasConnection1->dwBytesRcved );
  DbgPrint( "pRasConnection1->dwFramesXmited=%d\n", pRasConnection1->dwFramesXmited );
  DbgPrint( "pRasConnection1->dwFramesRcved=%d\n", pRasConnection1->dwFramesRcved);
  DbgPrint( "pRasConnection1->dwCrcErr=%d\n", pRasConnection1->dwCrcErr);
  DbgPrint( "pRasConnection1->dwTimeoutErr=%d\n", pRasConnection1->dwTimeoutErr);
  DbgPrint( "pRasConnection1->dwAlignmentErr=%d\n", pRasConnection1->dwAlignmentErr);
  DbgPrint( "pRasConnection1->dwHardwareOverrunErr=%d\n", pRasConnection1->dwHardwareOverrunErr);
  DbgPrint( "pRasConnection1->dwFramingErr=%d\n", pRasConnection1->dwFramingErr);
  DbgPrint( "pRasConnection1->dwBufferOverrunErr=%d\n", pRasConnection1->dwBufferOverrunErr);
}



//
// dump port0 struct to debug output
//
VOID Debug_Print_RAS_PORT0(RAS_PORT_0 *pRasPort0)
{
WCHAR *Line_Condition[] =
  {
  L"RAS_PORT_NON_OPERATIONAL",
  L"RAS_PORT_DISCONNECTED",
  L"RAS_PORT_CALLING_BACK",
  L"RAS_PORT_LISTENING",
  L"RAS_PORT_AUTHENTICATING",
  L"RAS_PORT_AUTHENTICATED",
  L"RAS_PORT_INITIALIZING"
  };

WCHAR *Hdw_Error[] =
  {
  L"RAS_HARDWARE_OPERATIONAL",
  L"RAS_HARDWARE_FAILURE"
  };

  //dumping pRasPort0
  DbgPrint("pRasPort0->hPort %d\n",pRasPort0->hPort);
  DbgPrint("pRasPort0->hConnection  0x%x\n",pRasPort0->hConnection);
  DbgPrint("pRasPort0->dwPortCondition %ws\n",Line_Condition[pRasPort0->dwPortCondition-1]);
  DbgPrint("pRasPort0->dwTotalNumberOfCalls %d\n",pRasPort0->dwTotalNumberOfCalls);
  DbgPrint("pRasPort0->dwConnectDuration %d\n",pRasPort0->dwConnectDuration);
  DbgPrint("pRasPort0->wszPortName %ws\n",pRasPort0->wszPortName);
  DbgPrint("pRasPort0->wszMediaName %ws\n",pRasPort0->wszMediaName);
  DbgPrint("pRasPort0->wszDeviceName %ws\n",pRasPort0->wszDeviceName);
  DbgPrint("pRasPort0->wszDeviceType %ws\n",pRasPort0->wszDeviceType);

}



//
// dump port1 struct to debug output
//
VOID Debug_Print_RAS_PORT1(RAS_PORT_1 *pRasPort1)
{
WCHAR *Line_Condition[] =
  {
  L"RAS_PORT_NON_OPERATIONAL",
  L"RAS_PORT_DISCONNECTED",
  L"RAS_PORT_CALLING_BACK",
  L"RAS_PORT_LISTENING",
  L"RAS_PORT_AUTHENTICATING",
  L"RAS_PORT_AUTHENTICATED",
  L"RAS_PORT_INITIALIZING"
  };

WCHAR *Hdw_Error[] =
  {
  L"RAS_HARDWARE_OPERATIONAL",
  L"RAS_HARDWARE_FAILURE"
  };

  //dumping pRasPort1
  DbgPrint("pRasPort1->hPort %d\n",pRasPort1->hPort);
  DbgPrint("pRasPort1->hConnection  0x%x\n",pRasPort1->hConnection);
  DbgPrint("pRasPort1->dwHardwareCondition %ws\n",Hdw_Error[pRasPort1->dwHardwareCondition]);

  //connection stats
  DbgPrint( "pRasPort1->dwLineSpeed=%d\n", pRasPort1->dwLineSpeed );
  DbgPrint( "pRasPort1->dwBytesXmited=%d\n", pRasPort1->dwBytesXmited );
  DbgPrint( "pRasPort1->dwBytesRcved=%d\n", pRasPort1->dwBytesRcved );
  DbgPrint( "pRasPort1->dwFramesXmited=%d\n", pRasPort1->dwFramesXmited );
  DbgPrint( "pRasPort1->dwFramesRcved=%d\n", pRasPort1->dwFramesRcved);
  DbgPrint( "pRasPort1->dwCrcErr=%d\n", pRasPort1->dwCrcErr);
  DbgPrint( "pRasPort1->dwTimeoutErr=%d\n", pRasPort1->dwTimeoutErr);
  DbgPrint( "pRasPort1->dwAlignmentErr=%d\n", pRasPort1->dwAlignmentErr);
  DbgPrint( "pRasPort1->dwHardwareOverrunErr=%d\n", pRasPort1->dwHardwareOverrunErr);
  DbgPrint( "pRasPort1->dwFramingErr=%d\n", pRasPort1->dwFramingErr);
  DbgPrint( "pRasPort1->dwBufferOverrunErr=%d\n", pRasPort1->dwBufferOverrunErr);
}


//
// dump connection0 struct to logfile
//
VOID File_Print_Connection0(RAS_CONNECTION_0 *pRasConnection0)
{
WCHAR *Interface_Type[] =
  {
  L"ROUTER_IF_TYPE_CLIENT",
  L"ROUTER_IF_TYPE_HOME_ROUTER",
  L"ROUTER_IF_TYPE_FULL_ROUTER",
  L"ROUTER_IF_TYPE_DEDICATED",
  L"ROUTER_IF_TYPE_INTERNAL",
  L"ROUTER_IF_TYPE_INTERNAL"
  };

  //dumping pRasConnection0
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "dumping pRasConnection0\n\n");
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection0->hConnection 0x%l64x\n",pRasConnection0->hConnection);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection0->hInterface  0x%l64x\n",pRasConnection0->hInterface);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection0->dwConnectDuration %d\n",pRasConnection0->dwConnectDuration);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection0->dwInterfaceType %ws\n",Interface_Type[pRasConnection0->dwInterfaceType]);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection0->dwConnectionFlags %d\n",pRasConnection0->dwConnectionFlags);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszInterfaceName %ws\n",pRasConnection0->wszInterfaceName);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszUserName %ws\n",pRasConnection0->wszUserName);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszLogonDomain %ws\n",pRasConnection0->wszLogonDomain);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection0->wszRemoteComputer %ws\n",pRasConnection0->wszRemoteComputer);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

}


//
// dump connection1 info to logfile
//
VOID File_Print_Connection1(RAS_CONNECTION_1 *pRasConnection1)
{

  //dumping pRasConnection1
  wnsprintfA(buf, CELEMS(buf), "dumping pRasConnection1\n");
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "\n\npRasConnection1->hConnection 0x%l64x\n",pRasConnection1->hConnection);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->hInterface  0x%l64x\n",pRasConnection1->hInterface);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.nbf.dwError %d\n",pRasConnection1->PppInfo.nbf.dwError);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.nbf.wszWksta %ws\n",pRasConnection1->PppInfo.nbf.wszWksta);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ip.dwError %d\n",pRasConnection1->PppInfo.ip.dwError);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ip.wszAddress %ws\n",pRasConnection1->PppInfo.ip.wszAddress);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ip.wszRemoteAddress %ws\n",pRasConnection1->PppInfo.ip.wszRemoteAddress);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ipx.dwError %d\n",pRasConnection1->PppInfo.ipx.dwError);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.ipx.wszAddress %ws\n",pRasConnection1->PppInfo.ipx.wszAddress);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.at.dwError %d\n",pRasConnection1->PppInfo.at.dwError );
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->PppInfo.at.wszAddress %ws\n",pRasConnection1->PppInfo.at.wszAddress);

  //connection stats
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwBytesXmited=%d\n", pRasConnection1->dwBytesXmited );
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwBytesRcved=%d\n", pRasConnection1->dwBytesRcved );
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwFramesXmited=%d\n", pRasConnection1->dwFramesXmited );
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwFramesRcved=%d\n", pRasConnection1->dwFramesRcved);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwCrcErr=%d\n", pRasConnection1->dwCrcErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwTimeoutErr=%d\n", pRasConnection1->dwTimeoutErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwAlignmentErr=%d\n", pRasConnection1->dwAlignmentErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwHardwareOverrunErr=%d\n", pRasConnection1->dwHardwareOverrunErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwFramingErr=%d\n", pRasConnection1->dwFramingErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasConnection1->dwBufferOverrunErr=%d\n", pRasConnection1->dwBufferOverrunErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
}



//
// dump port0 info to logfile
//
VOID File_Print_RAS_PORT0(RAS_PORT_0 *pRasPort0)
{
WCHAR *Line_Condition[] =
  {
  L"RAS_PORT_NON_OPERATIONAL",
  L"RAS_PORT_DISCONNECTED",
  L"RAS_PORT_CALLING_BACK",
  L"RAS_PORT_LISTENING",
  L"RAS_PORT_AUTHENTICATING",
  L"RAS_PORT_AUTHENTICATED",
  L"RAS_PORT_INITIALIZING"
  };

WCHAR *Hdw_Error[] =
  {
  L"RAS_HARDWARE_OPERATIONAL",
  L"RAS_HARDWARE_FAILURE"
  };

  //dumping pRasPort0 to a file
  wnsprintfA(buf, CELEMS(buf), "dumping pRasPort0 to file\n");
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort0->hPort %l64d\n",pRasPort0->hPort);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort0->hConnection  0x%l64x\n",pRasPort0->hConnection);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort0->dwPortCondition %ws\n",Line_Condition[pRasPort0->dwPortCondition-1]);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort0->dwTotalNumberOfCalls %d\n",pRasPort0->dwTotalNumberOfCalls);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort0->dwConnectDuration %d\n",pRasPort0->dwConnectDuration);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszPortName %ws\n",pRasPort0->wszPortName);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszMediaName %ws\n",pRasPort0->wszMediaName);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszDeviceName %ws\n",pRasPort0->wszDeviceName);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort0->wszDeviceType %ws\n",pRasPort0->wszDeviceType);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

}



//
// dump port1 info to logfile
//
VOID File_Print_RAS_PORT1(RAS_PORT_1 *pRasPort1)
{
WCHAR *Line_Condition[] =
  {
  L"RAS_PORT_NON_OPERATIONAL",
  L"RAS_PORT_DISCONNECTED",
  L"RAS_PORT_CALLING_BACK",
  L"RAS_PORT_LISTENING",
  L"RAS_PORT_AUTHENTICATING",
  L"RAS_PORT_AUTHENTICATED",
  L"RAS_PORT_INITIALIZING"
  };

WCHAR *Hdw_Error[] =
  {
  L"RAS_HARDWARE_OPERATIONAL",
  L"RAS_HARDWARE_FAILURE"
  };


  //dumping pRasPort1
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "\n dumping pRasPort1\n");
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->hPort %l64d\n",pRasPort1->hPort);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->hConnection  0x%l64x\n",pRasPort1->hConnection);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwHardwareCondition %ws\n",Hdw_Error[pRasPort1->dwHardwareCondition]);

  //connection stats
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwLineSpeed=%d\n", pRasPort1->dwLineSpeed );
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwBytesXmited=%d\n", pRasPort1->dwBytesXmited );
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwBytesRcved=%d\n", pRasPort1->dwBytesRcved );
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwFramesXmited=%d\n", pRasPort1->dwFramesXmited );
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwFramesRcved=%d\n", pRasPort1->dwFramesRcved);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwCrcErr=%d\n", pRasPort1->dwCrcErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwTimeoutErr=%d\n", pRasPort1->dwTimeoutErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwAlignmentErr=%d\n", pRasPort1->dwAlignmentErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwHardwareOverrunErr=%d\n", pRasPort1->dwHardwareOverrunErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwFramingErr=%d\n", pRasPort1->dwFramingErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);
  wnsprintfA(buf, CELEMS(buf), "pRasPort1->dwBufferOverrunErr=%d\n", pRasPort1->dwBufferOverrunErr);
  WRITE_LOG_FILE(cLogFile, (LPSTR)buf, (int) strlen(buf), &dwBytesWritten, NULL);

}


//
// Function to clear port statistics.
//
VOID ProcPortClearStat(HANDLE hPort)
{
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR Buf[512];
WCHAR *lpszString;
lpszString = &Buf[0];

  if (phRasServer==NULL)
   return;
   
  // API Called:   MprAdminPortClearStats
  // Parameters:
  // IN RAS_SERVER_HANDLE phRasServer
  // IN HANDLE hPort
  Status = MprAdminPortClearStats(phRasServer, hPort);
  if (Status != NO_ERROR)
  {
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortClearStats  %d\n",Status);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   dwResult = MprAdminGetErrorString(Status,&lpszString);
   if (dwResult == ERROR_SUCCESS)
   {
     DbgPrint("ERROR MprAdminPortClearStats   %ws\n",lpszString);
     wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortClearStats   %ws\n",lpszString);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }
  else
  {
   DbgPrint("\n\nMprAdminPortClearStats Called From ProcPortClearStat, Now dumping structs \n");
   wnsprintfA(szBuf, CELEMS(szBuf), "\n\nMprAdminPortClearStats Called From ProcPortClearStat, Now dumping structs\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   ProcPortGetInfo(hPort);
  }

}



//
// Function to clear connection statistics.
//
VOID ProcConnectionClearStat(HANDLE hConnection)
{
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR Buf[512];
WCHAR *lpszString;
lpszString = &Buf[0];

  if (phRasServer==NULL)
   return;
   
  // API Called:   MprAdminConnectionClearStats
  // Parameters:
  // IN RAS_SERVER_HANDLE phRasServer
  // IN HANDLE hConnection
  Status = MprAdminConnectionClearStats(phRasServer, hConnection);
  if (Status != NO_ERROR)
  {
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionClearStats  %d\n",Status);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   dwResult = MprAdminGetErrorString(Status, &lpszString);
   if (dwResult == ERROR_SUCCESS)
   {
     DbgPrint("ERROR MprAdminConnectionClearStats   %ws\n",lpszString);
     wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionClearStats   %ws\n",lpszString);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }
  else
  {
   DbgPrint("\n\nMprAdminConnectionClearStats Called From ProcConnectionClearStat, Now dumping structs \n");
   wnsprintfA(szBuf, CELEMS(szBuf), "\n\nMprAdminConnectionClearStats Called From ProcConnectionClearStat, Now dumping structs\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   ProcConnectionGetInfo(hConnection);
  }
}


//
// Function to reset port.
//
VOID ProcPortReset(HANDLE hPort)
{
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR Buf[512];
WCHAR *lpszString;
lpszString = &Buf[0];

  if (phRasServer==NULL)
   return;
   
  // API Called:   MprAdminPortReset
  // Parameters:
  // IN RAS_SERVER_HANDLE phRasServer
  // IN HANDLE hPort
  Status = MprAdminPortReset(phRasServer, hPort);
  if (Status != NO_ERROR)
  {
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortReset  %d\n",Status);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   dwResult = MprAdminGetErrorString(Status, &lpszString);
   if (dwResult == ERROR_SUCCESS)
   {
     DbgPrint("ERROR MprAdminPortReset   %ws\n",lpszString);
     wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortReset   %ws\n",lpszString);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }
  else
  {
   DbgPrint("\n\nMprAdminPortReset Called From ProcPortReset, Now dumping structs \n");
   wnsprintfA(szBuf, CELEMS(szBuf), "\n\nMprAdminPortReset Called From ProcPortReset, Now dumping structs\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   ProcPortGetInfo(hPort);
  }
}


//
// Function to disconnect port.
//
VOID ProcPortDisconnect(HANDLE hPort)
{
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR Buf[512];
WCHAR *lpszString;
lpszString = &Buf[0];

  if (phRasServer==NULL)
   return;
   
  // API Called:   MprAdminPortDisconnect
  // Parameters:
  // IN RAS_SERVER_HANDLE phRasServer
  // IN HANDLE hPort
  Status = MprAdminPortDisconnect(phRasServer, hPort);
  if (Status != NO_ERROR)
  {
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortDisconnect  %d\n",Status);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   dwResult = MprAdminGetErrorString( Status, &lpszString);
   if (dwResult == ERROR_SUCCESS)
   {
     DbgPrint("ERROR MprAdminPortDisconnect   %ws\n",lpszString);
     wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortDisconnect   %ws\n",lpszString);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }
}



//
// Function to reset port statistics
//
DWORD WINAPI RasAdminClearDisc(LPVOID param)
{
CHAR option= ' ';
WORD i = 0;
INT k = 0;

  while (!Quit)
  {
   // If the user hits q or Q then this will exit gracefully.
   // It may take some time to exit though.
   printf("Type Q to Quit\n");
   do
   {
     option = (CHAR)_getch();
     option = (CHAR)toupper(option);
     printf("%c\n",option);
   } while (((option) != 'q')&& ((option) != 'Q'));

   if (option == 'Q')
   {
     Quit = TRUE;
   }
  }
  return(0);
}

VOID ProcConnectionGetInfo(HANDLE hConnection)
{
RAS_CONNECTION_0 *pRasConnection0;
RAS_CONNECTION_1 *pRasConnection1;
LPBYTE lplpbBuffer;
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR *lpszString;
WCHAR Buf[512];
lpszString = &Buf[0];

  if (phRasServer==NULL)
   return;
   
  // API Called: MprAdminConnectionGetInfo
  // Parameters:
  // IN RAS_SERVER_HANDLE phRasServer
  // IN DWORD  dwLevel
  // IN HANDLE  hConnection
  // OUT LPBYTE * lplpbBuffer
  Status = MprAdminConnectionGetInfo(phRasServer,0,hConnection,&lplpbBuffer);
  if (Status != NO_ERROR)
  {
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionGetInfo  %d\n",Status);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   dwResult = MprAdminGetErrorString( Status, &lpszString);
   if (dwResult == NO_ERROR)
   {
     wnsprintfA(szBuf,CELEMS(szBuf), "ERROR MprAdminConnectionGetInfo   %ws\n",lpszString);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }
  else
  {
   pRasConnection0 = (RAS_CONNECTION_0 *) lplpbBuffer;
   wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping RpRasConnection0::Called from ProcConnectionGetinfo:->MprAdminConnectionGetInfo\n");
       WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   File_Print_Connection0(pRasConnection0);
   DbgPrint("\n\nDumping RpRasConnection0::Called from ProcConnectionGetinfo:->MprAdminConnectionGetInfo\n");
   Debug_Print_Connection0(pRasConnection0);
   MprAdminBufferFree(pRasConnection0);
  }

  Status = MprAdminConnectionGetInfo(phRasServer,1,hConnection,&lplpbBuffer);
  if (Status != NO_ERROR)
  {
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionGetInfo  %d\n",Status);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   dwResult = MprAdminGetErrorString( Status, &lpszString);
   if (dwResult == NO_ERROR)
   {
     wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionGetInfo   %ws\n",lpszString);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }
  else
  {
   pRasConnection1 = (RAS_CONNECTION_1 *) lplpbBuffer;
   wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping RpRasConnection1::Called from ProcConnectionGetinfo:->MprAdminConnectionGetInfo\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   File_Print_Connection1(pRasConnection1);
   DbgPrint("\n\nDumping RpRasConnection1::Called from ProcConnectionGetinfo:->MprAdminConnectionGetInfo\n");
   Debug_Print_Connection1(pRasConnection1);
   MprAdminBufferFree(pRasConnection1);
  }
}


//
// get port info
//
VOID ProcPortGetInfo(HANDLE hPort)
{
RAS_PORT_0 *pRasPort0;
RAS_PORT_1 *pRasPort1;
LPBYTE lplpbBuffer;
DWORD dwBytesWritten = 0;
CHAR szBuf[120];
WCHAR *lpszString;
WCHAR Buf[512];
lpszString = &Buf[0];

  if (phRasServer==NULL)
   return;

  // API Called: MprAdminPortGetInfo
  // Parameters:
  // IN RAS_SERVER_HANDLE phRasServer
  // IN DWORD  dwLevel
  // IN HANDLE  hPort
  // OUT LPBYTE * lplpbBuffer
  Status = MprAdminPortGetInfo(phRasServer,0,hPort,&lplpbBuffer);
  if (Status != NO_ERROR)
  {
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortGetInfo  %d\n",Status);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   dwResult = MprAdminGetErrorString( Status, &lpszString);
   if (dwResult == NO_ERROR)
   {
     wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortGetInfo   %ws\n",lpszString);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }
  else
  {
   pRasPort0 = (RAS_PORT_0 *) lplpbBuffer;
   wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping RpRasPort0::Called from ProcPortGetInfo:-> MprAdminPortGetInfo\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   File_Print_RAS_PORT0(pRasPort0);
   DbgPrint("\n\nDumping RpRasPort0::Called from ProcPortGetInfo:->MprAdminPortGetInfo\n");
   Debug_Print_RAS_PORT0(pRasPort0);
   MprAdminBufferFree(pRasPort0);
  }

  Status = MprAdminPortGetInfo(phRasServer,1,hPort,&lplpbBuffer);
  if (Status != NO_ERROR)
  {
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminPortGetInfo  %d\n",Status);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   dwResult = MprAdminGetErrorString( Status, &lpszString);
   if (dwResult == NO_ERROR)
   {
     wnsprintfA(szBuf,CELEMS(szBuf), "ERROR MprAdminPortGetInfo   %ws\n",lpszString);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }
  else
  {
   pRasPort1 = (RAS_PORT_1 *) lplpbBuffer;
   wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping pRasPort1::Called from ProcPortGetInfo:->MprAdminPortGetInfo\n");
   WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   File_Print_RAS_PORT1(pRasPort1);
   DbgPrint("\n\nDumping RpRasConnection1::Called from ProcPortGetInfo:->MprAdminPortGetInfo\n");
   Debug_Print_RAS_PORT1(pRasPort1);
   MprAdminBufferFree(pRasPort1);
  }
}


/*************************************************************************/
/***************** Start Main ********************************************/
/*************************************************************************/

void _cdecl main(int argc, char **argv)
{
INT LoopPriv = 0;
INT Error = 0;
CHAR szBuf[120];
DWORD dwBytesWritten = 0;
DWORD Dialin = 1;
WORD i = 0;
INT_PTR id = 0;
WCHAR *lpszString;
WCHAR Buf[512];
HANDLE ConnectDiscThread;
LPBYTE lplpbBuffer;
DWORD lpdwEntriesRead = 0;
DWORD lpdwTotalEntries = 0;
LPDWORD lpdwResumeHandle=NULL;
RAS_CONNECTION_0 *pRasConnection0;
LPBYTE plplpbBuffer;
DWORD plpdwPrefMaxLen = 0;
DWORD plpdwEntriesRead = 0;
DWORD plpdwTotalEntries = 0;
DWORD plpdwResumeHandle = 0;
RAS_PORT_0 *pRasPort0;
HANDLE hConnection = 0;
lpszString = &Buf[0];

 if (argc > 1)
 {
  mbstowcs(RasSrv, argv[1], 32) ;
 }
 Init1();
 Init2();
 Error=IsServiceRunning(RasSrv);
 if (!Error)
 {
  printf ("Ras Server is not started on the system");
  exit(0);
 }
 printf("Please specify the Client's phone number or IP address\n");
 scanf("%ws", CallbackNumber);
 ConnectDiscThread = CreateThread (NULL,
                 0,
                 &RasAdminClearDisc,
                 (LPVOID)&id,
                 0,
                 (LPDWORD)&id);
 while (!Quit)
 {
 // API Called:   MprAdminConnectionEnum
 // Parameters:
 // IN RAS_SERVER_HANDLE phRasServer
 // IN DWORD dwLevel
 // OUT LPBYTE * lplpbBuffer  (RAS_CONNECTION_0 array)
 // IN DWORD dwPrefMaxLen
 // OUT LPDWORD lpdwEntriesRead
 // OUT LPDWORD lpdwdTotalEntries
 // IN LPDWORD lpdwResumeHandle OPTIONAL

 // Free up lplpbBuffer by calling MprAdminFreeBuffer API

  lpdwEntriesRead = 0;

  Status = MprAdminConnectionEnum(phRasServer,(DWORD) 0,&lplpbBuffer,(DWORD)-1,
                  &lpdwEntriesRead,&lpdwTotalEntries,lpdwResumeHandle);
  if (Status != NO_ERROR) //error
  {
   wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionEnum  %d\n",Status);
   WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   dwResult = MprAdminGetErrorString( Status, &lpszString);
   if (dwResult == NO_ERROR)
   {
     wnsprintfA(szBuf, CELEMS(szBuf), "ERROR MprAdminConnectionEnum   %ws\n",lpszString);
     WRITE_LOG_FILE(LogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
   }
   else
     PrintGetStringError(dwResult);
  }
  else //no error
  {
   if (lpdwEntriesRead == lpdwTotalEntries)
   {
     pRasConnection0 = (RAS_CONNECTION_0 *) lplpbBuffer;
     for (i=0; i < (DWORD)lpdwTotalEntries;i++)
     {
      wnsprintfA(szBuf, CELEMS(szBuf), "\n\nDumping RpRasConnection0::Called from MprAdminConnectionEnum\n");
      WRITE_LOG_FILE(cLogFile, (LPSTR)szBuf, (int) strlen(szBuf), &dwBytesWritten, NULL);
      File_Print_Connection0(&pRasConnection0);
      DbgPrint("\n\nDumping RpRasConnection0::Called from MprAdminConnectionEnum\n");
      Debug_Print_Connection0(&pRasConnection0);
      ProcConnectionGetInfo(pRasConnection0.hConnection);
      // pass hConnection = handle from MprAdminConnectionEnum
      hConnection = pRasConnection0.hConnection;
      //alternatively, could pass hConnection = INVALID_HANDLE_VALUE;
      Sleep (500);
      // A good idea is to call UserPrivilege outside the loop. It doesn't really
      // make sense to go through the privilege change for every iteration.
      // However, this code is just intended to demonstrate the usage.
      if (lpdwEntriesRead > 0)
    {
    UserPrivilege(pRasConnection0.wszLogonDomain,pRasConnection0.wszUserName);
    }
      ProcConnectionClearSt
277  Foros Generales / Dudas Generales / Necesito poder conmutar o conectar una llamada telefónica a mi PC ? en: 10 Diciembre 2012, 15:55 pm
Holas chikos, veran quiero hacer un regalo por fin de año y es que tengo a unos parientes de mi esposa con los cuales nos comunicamos por el Yahoo Messenger usando video conferencia y todo de maravillas hablamos podemos vemos en fin todo perfecto.

Mi duda es que quisiera ampliar eso un poquito para que esos parientes pueda hablar con mis suegros y bueno ya aqui se complica un poco las cosas, yo tengo una linea de telefono y un modem 56k Motorola PCI, quisiera saber como puedo hacer para llamar desde mi modem a mis suegros y conectar esa llamada una ves que ellos respondan a algun programa para que puedan hablar.

Interconectarlos... cuando les pido esto asi es se me hace dificil algo sobre Voip igual me dan alguna solucion, los parientes quizas puedan pagar algun servicio bien barato y entonces yo hacer eso que quiero hacer... nada espero ideas... gracias

Gracias y salu2
278  Programación / .NET (C#, VB.NET, ASP) / Se puede desactivar y activar esto desde mi programa ??? en: 8 Diciembre 2012, 17:51 pm


Lo que necesito es poder desde mi aplicación desactivar esa casilla y activarla a mi antojo, le puse un monitor de registro para ver las entradas en el REGEDIT que modifica pero al parecer todas las casillas que el configura nada mas son de información o sea que las vuelto a colocar con los valores que tenia anterior a que el las modificara y nada cuando entra una llamada se activa el módem.....

El módem no lo puedo deshabilitar porque lo uso con otros programas.

Activar y desactivar el servicio que atiende esto no es viable porque me es necesario hacer esa tarea muchas veces al día y con un servicio da problemas.

Cualquier ayuda sera bienvenida..
279  Programación / .NET (C#, VB.NET, ASP) / Ayuda con Proyecto !! en: 4 Diciembre 2012, 21:39 pm
Amigos que tal les comento rapido, buscando por la Web informacion sobre como usar la API TAPI3 encontre 2 proyectos uno en C# y otro en Vb.Net, obviamente quisiera usar el ultimo, pero tengo una problematica cuando creo un proyecto e implemento la Clase que se usa ahi me da un error: Interop type 'TAPIClass' cannot be embedded. Use the applicable interface instead.

Lo mas raro es que cuando cargo el proyecto no da error y esta identico, el lio es cuando creo un proyecto nuevo y copio toda la clase, declaro las referencias que usa hacia la TAPI3 y nada me da ese error..entonces continuo me es necesario cargar los modem que el detecte en un ComboBox para seleccionar el que desee y entonces desde un boton agregarle el codigo para que lo ponga en estado de monitor.

Todo el codigo esta en la clase lo que necesito es poder interactuar con ella.

El proyecto es el siguiente http://www.codeproject.com/Articles/11238/Working-with-TAPI-3-x-from-NET

no se como les podria subir los archivos son pequeños menos de 100 KB

cualquier duda preguntenme
280  Programación / .NET (C#, VB.NET, ASP) / Windows CE y RAS Server/PPTP Server (Incoming) ?? en: 30 Noviembre 2012, 15:50 pm
Señores quisiera tratar de diseñar una aplicación tipo SERVER RAS y buscando en la Microsoft encuentro este tema:

http://msdn.microsoft.com/en-us/library/ms924929.aspx

Ahora lo que no entiendo:

El Windows CE funciona como una aplicacion o es un Windows como el XP ?

Es necesario instalar el Windows CE para el desarrollo de la aplicación?

No puedo desarrollar esta aplicación desde VS2010 o VS2012 en un Windows Xp o Windows 8 ??

Y si no es mucha molestia, si tuviera que instalar el Windows CE me pueden dar alguna version estable ?

GRacias
Páginas: 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [28] 29 30 31 32 33 34 35
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines