⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 name.c

📁 我自己编译的armv4i wince60模拟器的bps源文件,已经验证可以使用,欢迎下载
💻 C
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
//------------------------------------------------------------------------------
//
//  File:  name.c
//
#include <windows.h>
#include <oal.h>

//------------------------------------------------------------------------------
//
//  Function:  OALKitlCreateName
//
//  This function create device name from prefix and mac address.
//
VOID OALKitlCreateName(CHAR *pPrefix, UINT16 mac[3], CHAR *pBuffer)
{
    UINT32 count;
    UINT8  i, digit;

    OALMSG(OAL_KITL&&OAL_FUNC, (
        L"+OALKitlCreateName('%hs', 0x%04x, 0x%08x)\r\n", pPrefix, mac, pBuffer
    ));
    
    // KITL name will be prefix + MAC Address.  If need be, truncate the prefix
    // and leave room for 12 MAC chars + terminating null.
    count = 0;
    while (count < OAL_KITL_ID_SIZE - 13 && pPrefix[count] != '\0') {
        pBuffer[count] = pPrefix[count];
        count++;
    }        

    // Now just append the MAC address.  We have to use the whole
    // thing or we can't guarantee a unique ID for multiple instances of
    // the emulator on one host PC (CE bug 106368).
    for (i = 0; i < 3; i++)
    {
        digit = (mac[i] & 0x00F0) >> 4;
        pBuffer[count++] = digit < 10 ? digit + '0' : digit-10 + 'A';

        digit = (mac[i] & 0x000F);
        pBuffer[count++] = digit < 10 ? digit + '0' : digit-10 + 'A';

        digit = (mac[i] & 0xF000) >> 12;
        pBuffer[count++] = digit < 10 ? digit + '0' : digit-10 + 'A';

        digit = (mac[i] & 0x0F00) >> 8;
        pBuffer[count++] = digit < 10 ? digit + '0' : digit-10 + 'A';
    }
    pBuffer[count] = '\0';

    OALMSG(OAL_KITL&&OAL_FUNC, (
        L"-OALKitlCreateName(pBuffer = '%hs')\r\n", pBuffer
    ));
}

//------------------------------------------------------------------------------

⌨️ 快捷键说明

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