main.c

来自「wince底层驱动开发代码 ARM作为一种嵌入式系统处理器」· C语言 代码 · 共 57 行

C
57
字号
#include <windows.h>#include <ras.h>#include "usbcnect.h" VOID CreateRASEntry(HINSTANCE hinst)  {     DWORD           cb;     RASENTRY        RasEntry;      TCHAR name[256];     LoadString(hinst, IDS_DEFAULT_NAME, name, 256);      // This will create the default entries if the key does not exist.      RasEntry.dwSize = sizeof(RASENTRY);     cb = sizeof(RASENTRY);     RasGetEntryProperties (NULL, TEXT(""), &RasEntry, &cb, NULL, NULL);      // Now set up the entry the way we want it (like "`115200 Default")     TCHAR szDeviceName[RAS_MaxDeviceName + 1];     LoadString(hinst, SOCKET_FRIENDLY_NAME, szDeviceName, RAS_MaxDeviceName + 1);     _tcsncpy (RasEntry.szDeviceName, szDeviceName, RAS_MaxDeviceName + 1);      // And finally, write the new entry out     if ( RasSetEntryProperties (NULL, name,                                 &RasEntry, sizeof(RasEntry), NULL, 0) )      {         DEBUGMSG (1, (TEXT("Error %d from RasSetEntryProperties\r\n"),                       GetLastError()));     }      else      {         DEBUGMSG (1, (TEXT("RasEntry '%s' Created\r\n"), name));     }      // Now, delete the link file.    TCHAR szUsbcnectLnk[256];    LoadString(hinst, IDS_USBCNECT_LINK, szUsbcnectLnk, 256);    BOOL fDeleted = DeleteFile(szUsbcnectLnk);    if (!fDeleted)    {        DWORD dwDeletedError = GetLastError();        DEBUGMSG(1, (TEXT("Usbcnect.lnk not deleted.  Error %i\r\n"), (UINT) dwDeletedError));    }} int WINAPI WinMain(    HINSTANCE hinst,    HINSTANCE hinstPrev,    LPWSTR szCmdLine,    int iCmdShow){    CreateRASEntry(hinst);    return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?