Windows CE.NET 4.1 QFE 020930_2002Q3

 

© 2002 Microsoft Corporation. All rights reserved.

 

 

How to Install this QFE

All QFEs for Windows CE.NET 4.1 require the following:

 

1) Platform Builder.NET 4.1 is installed on the machine.

2) The current user has run Platform Builder.NET 4.1 at least once.

 

Please download the file(s) most appropriate for your installation, as follows:

 

020930_ARMV4I_WCE41-2002Q3.EXE     For installations based upon the ARM V4I family processors
020930_ARMV4T_WCE41-2002Q3.EXE     For installations based upon the ARM V4T family processors
020930_ARMV4_WCE41-2002Q3.EXE     For installations based upon the ARM V4 family processors
020930_MIPS16_WCE41-2002Q3.EXE     For installations based upon the MIPS-16 family processors
020930_MIPSII_FP_WCE41-2002Q3.EXE     For installations based upon the MIPS II floating point family processors
020930_MIPSII_WCE41-2002Q3.EXE     For installations based upon the MIPS II family processors
020930_MIPSIV_FP_WCE41-2002Q3.EXE     For installations based upon the MIPS IV floating point family processors
020930_MIPSIV_WCE41-2002Q3.EXE     For installations based upon the MIPS IV family processors
020930_SH3_WCE41-2002Q3.EXE     For installations based upon the Hitachi SH3 processor
020930_SH4_WCE41-2002Q3.EXE     For installations based upon the Hitachi SH4 processor
020930_X86_WCE41-2002Q3.EXE     For installations based upon the Intel x86 family processors

 

This package will install all QFEs directly to your build environment.  A backup of all updated files will be maintained at the following location:  %_WINCEROOT%\BACKUP.  You can remove any files from this directory at your choosing.

  

If You Have Installed Previous QFEs

If you have installed previous QFEs (for Windows CE.NET 4.1), this will update your build environment to include the latest files for this component.

 

If You See "These files were NOT installed"

If this message is displayed, it means that you have installed a QFE package with a later version of the installed file.  You will already have the updates mentioned in this document, including something later (documented with that later QFE).  This message is displayed to prevent accidental overwrite of the latest Windows CE QFE to that particular component.

 

 

Updates without public code changes are listed first, the updates which contain code changes are last.  The basic information about these updates will be listed twice - first with the specific component in the "By Component" list below, and again at the bottom.

 

 

Fixes Made in this QFE:

 

By Component:

 

Component:  ActiveSync

Component:  COMM

Component:  COMMCTRL

Component:  CPLMAIN

Component:  CRYPT32

Component:  CVTRBIN

Component:  DirectX

Component:  FATFS

Component:  File Viewers

This QFE fixes the following issue with the “File Viewers” Project

 

  1. The wrong data file ICONs are referenced in the viewers.reg file.

  2. The Image Viewer recent directories drop down list was sized too small.

  3. The Excel Viewer was not correctly displaying slide names.

  4. The PowerPoint Viewer was not correctly displaying the black slide when utilizing an external display.

  5. The PDF Viewer object files are corrupt.

Additional PDF Viewer Notes:

 

Support format includes PDF documents compliant with version 1.3 (or earlier) of the PDF format.

 

The PDF Viewer has additional font requirements. The v1.3 of the PDF specification calls for the following standard fonts commonly used in PDF files: Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique, Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique, Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic, Symbol and ZapfDingbats.

 

 

Windows CE does not ship several of these fonts so the PDF Viewer will make the following substitutions:

 

Courier --> Courier New

Helvetica --> Arial

Times --> Times New Roman

Symbol --> Symbol

ZapfDingbats --> Wingding

 

It is recommended that OEMs include these five fonts to enable a positive user experience with the PDF Viewer.

 

Current PDF Viewer Limitations:

  1. CCITTFaxDecode images are not supported

  2. Encrypted files are not supported.  An error message is displayed when an encrypted documents is encountered.

  3. Acrobat Forms are not supported and no content will be shown.

  4. Type 3 fonts are not supported but some attempt is made to map them if a ToUnicode mapping exists.

  5. Type 1 fonts are mapped using either the Encoding or ToUnicode mappings depending upon what is available.

  6. Clip paths are not supported.

  7. Polypolygons will be treated as polygons and may have the interiors filled.

  8. Embedded TrueType fonts are not used but are mapped to existing fonts already installed on the system.

  9. Colors from unsupported colors spaces (such as ICCBased or DeviceN color) may be displayed incorrectly.

  10. Text is only shown at 90 degree rotations.

  11. Predictive ZIP decoding and CMYK JPEGs are not supported.

Component:  FSMAIN

A new registry key was implemented with this QFE.  If it is not set, Windows CE will use its default value.

 

Key:  HKLM\System\ObjectStore

Value:  "CompactionPrio256" = dword:0

 

0 is the highest priority, 255 (THREAD_PRIORITY_IDLE) is the lowest.

Component:  GWES

Component:  ImageViewer

Component:  IME

Component:  Kernel

Component:  L3CODECL

Component:  Messenger

Component:  MSTSC, MSGQUE

Component:  NETUI

Component:  NMAKE

Component:  pWord

Component:  Shell

Component:  RDNIS

Component:  TCP/IP

Component:  WININET

---------------------------------------------------------------------------------------------------------------------------------

 

The following issues contain public code changes.  Please read all details associated with each update before applying these changes.

 

 

Component:  COMM

The following two code changes will resolve this issue.  Listed below is the function that needs to be changed - first is BEFORE, second is AFTER.  Changes and additions are noted in BOLD, deletions are noted in RED.

 

FILE:  PUBLIC\COMMON\OAK\DRIVERS\NETSAMP\CONNMC\LANCONNINFO.CPP

 

In function LanConnInfo::defaultAction()

 

 

BEFORE:

 

BOOL LanConnInfo::defaultAction(HINSTANCE hInstance, HWND hParent, UINT * pError)
{
    HCURSOR     hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
    TCHAR       multiSz[256];
    DWORD       cbBuffer = sizeof(multiSz);

    ::_tcscpy(multiSz, this->pszAdapter);
    multiSz[::_tcslen(multiSz)+1] = _T('\0'); // Multi sz needs an extra null

    //
    // Issue the PwrDeviceUnspecified or D4 to the adapter if it supports power management.
    //

    if (fSupportsPowerManagment)
    {
        CEDEVICE_POWER_STATE Dx = PwrDeviceUnspecified;
        TCHAR                szName[MAX_PATH];
        int                  nChars;

        //
        // Inform ndispwr.dll on the power state of this adapter..
        //

        HANDLE                     hNdisPwr;
        NDISPWR_SAVEPOWERSTATE     SavePowerState;

        hNdisPwr = CreateFile(
                            (PTCHAR)NDISPWR_DEVICE_NAME,                    // Object name.
                            0x00,                                           // Desired access.
                            0x00,                                           // Share Mode.
                            NULL,                                           // Security Attr
                            OPEN_EXISTING,                                  // Creation Disposition.
                            FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,   // Flag and Attributes..
                            (HANDLE)INVALID_HANDLE_VALUE);

        if (hNdisPwr != INVALID_HANDLE_VALUE)
        {
            SavePowerState.pwcAdapterName = pszAdapter;

            //
            // If it is currently enabled, set the power level to D4.
            //

            if (fEnabled)
                SavePowerState.CePowerState = D4;
            else
            {
                //
                // Don't set to D0 in here because that implies we want the
                // device to be always in D0 (even when suspending).
                // Setting to PwrDeviceUnspecified reenables the normal
                // power management to the device.
                //

                SavePowerState.CePowerState = PwrDeviceUnspecified;
            }

            DeviceIoControl(
                hNdisPwr,
                IOCTL_NPW_SAVE_POWER_STATE,
                &SavePowerState,
                sizeof(NDISPWR_SAVEPOWERSTATE),
                NULL,
                0x00,
                NULL,
                NULL);

            CloseHandle(hNdisPwr);
        }

        nChars = _sntprintf(
                    szName,
                    MAX_PATH-1,
                    _T("%s\\%s"),
                    PMCLASS_NDIS_MINIPORT,
                    pszAdapter);

        szName[MAX_PATH-1]=0;

        if(nChars != (-1))
        {
            if (fEnabled)
            {
                //
                // Currently enabled, power down to D4
                //

                if (ERROR_SUCCESS != ::SetDevicePower(szName, POWER_NAME, D4))
                {
                    if (pError)
                        *pError = IDS_ERROR;
                }
            }
            else
            {
                //
                // Currently disabled, get it back to default.
                //

                if (ERROR_SUCCESS != ::SetDevicePower(szName, POWER_NAME, PwrDeviceUnspecified))
                {
                    if (pError)
                        *pError = IDS_ERROR;
                }
            }
        }
    }
 

 

AFTER:

 

BOOL LanConnInfo::defaultAction(HINSTANCE hInstance, HWND hParent, UINT * pError)
{
    HCURSOR     hCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
    TCHAR       multiSz[256];
    DWORD       cbBuffer = sizeof(multiSz);

    HANDLE                     hNdisPwr;
    NDISPWR_SAVEPOWERSTATE     SavePowerState;

    ::_tcscpy(multiSz, this->pszAdapter);
    multiSz[::_tcslen(multiSz)+1] = _T('\0'); // Multi sz needs an extra null

        //
        // Inform ndispwr.dll on the power state of this adapter..
        //


        hNdisPwr = CreateFile(
                            (PTCHAR)NDISPWR_DEVICE_NAME,     // Object name.
                            0x00,                            // Desired access.
                            0x00,                            // Share Mode.
                            NULL,                            // Security Attr
                            OPEN_EXISTING,                   // Creation Disposition.
                            FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,     // Flag and Attributes..
                            (HANDLE)INVALID_HANDLE_VALUE);

        if (hNdisPwr != INVALID_HANDLE_VALUE)
        {
            SavePowerState.pwcAdapterName = pszAdapter;

            //
            // If it is currently enabled, set the power level to D4.
            //

            if (fEnabled)
                SavePowerState.CePowerState = D4;
            else
            {
                //
                // Don't set to D0 in here because that implies we want the
                // device to be always in D0 (even when suspending).
                // Setting to PwrDeviceUnspecified reenables the normal
                // power management to the device.
                //

                SavePowerState.CePowerState = PwrDeviceUnspecified;
            }

            DeviceIoControl(
                hNdisPwr,
                IOCTL_NPW_SAVE_POWER_STATE,
                &SavePowerState,
                sizeof(NDISPWR_SAVEPOWERSTATE),
                NULL,
                0x00,
                NULL,
                NULL);

            CloseHandle(hNdisPwr);
        }
    //
    // Issue the PwrDeviceUnspecified or D4 to the adapter if it supports power management.
    //

    if (fSupportsPowerManagment)
    {
        CEDEVICE_POWER_STATE Dx = PwrDeviceUnspecified;
        TCHAR                szName[MAX_PATH];
        int                  nChars;

        nChars = _sntprintf(
                        szName,
                        MAX_PATH-1,
                        _T("%s\\%s"),
                        PMCLASS_NDIS_MINIPORT,
                        pszAdapter);

        szName[MAX_PATH-1]=0;

        if(nChars != (-1))
        {
            if (fEnabled)
            {
                //
                // Currently enabled, power down to D4
                //

                if (ERROR_SUCCESS != ::SetDevicePower(szName, POWER_NAME, D4))
                {
                    if (pError)
                        *pError = IDS_ERROR;
                }
            }
            else
            {
                //
                // Currently disabled, get it back to default.
                //

                if (ERROR_SUCCESS != ::SetDevicePower(szName, POWER_NAME, PwrDeviceUnspecified))
                {
                    if (pError)
                        *pError = IDS_ERROR;
                }
            }
        }
    }
 

 

 

FILE: PUBLIC\COMMON\OAK\DRIVERS\NETSAMP\NDISPWR\NDISPWR.C

 

BEFORE:

 

Several significant changes were made to this file.  Instead of displaying this as BEFORE/AFTER, only the new file will be displayed.  Updates are still shown in BOLD.

 

 

AFTER:

 

//

// Copyright (c) Microsoft Corporation.  All rights reserved.

//

//

// Use of this source code is subject to the terms of the Microsoft end-user

// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.

// If you did not accept the terms of the EULA, you are not authorized to use

// this source code. For a copy of the EULA, please see the LICENSE.RTF on your

// install media.

//

/*++

 

THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF

ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO

THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A

PARTICULAR PURPOSE.

 

Module Name: 

 

            datalog.c

 

Abstract: 

 

            This module remembers the powre state of NDIS adapters set by

    ConnMC.  ConnMC calls IOCTL_NPW_SET_POWER to let us know what the

    power state of the adapter is.

    This module receives BIND notification from NDISUIO.

    It will then check the last set power state and issue that state

    to the adapter.

   

 

Author:

 

 

Environment:

 

 

Revision History:

   

    November 2001  :: Original version.

 

  

--*/

 

#include <windows.h>

#include <types.h>

#include <ntcompat.h>

#include <pm.h>

#include <ndis.h>

#include <windev.h>

#include <nuiouser.h>

#include <msgqueue.h>

#include <ndispwr.h>

 

 

//

//  Forward decl

//

 

BOOL

NpwStartNotification(LPVOID pUnused);

 

BOOL

SavePowerState(PWCHAR pwcAdapterName, CEDEVICE_POWER_STATE  CePowerState);

 

 

//

//          Global vars..

//

 

CRITICAL_SECTION    g_GlobalCS;

HANDLE              g_hMsgQueue = NULL;

HANDLE              g_hNdisuio  = NULL;

 

 

 

//

//          Debug Zones.

//

 

#ifdef DEBUG

 

#define ZONE_INIT           DEBUGZONE(0)

#define ZONE_NDISUIO        DEBUGZONE(1)

#define ZONE_POWERSAVE      DEBUGZONE(2)

#define ZONE_ERROR          DEBUGZONE(15)

 

DBGPARAM  dpCurSettings =

{

    TEXT("NdisPower"),

            {

                        TEXT("Init"),               

                        TEXT("NdisUio"),

        TEXT("PowerSave"),

        TEXT("Undefined"),

                        TEXT("Undefined"),

                        TEXT("Undefined"),

                        TEXT("Undefined"),

                        TEXT("Undefined"),

                        TEXT("Undefined"),

                        TEXT("Undefined"),

                        TEXT("Undefined"),

                        TEXT("Undefined"),

                        TEXT("Undefined"),                

                        TEXT("Undefined"),                

                        TEXT("Undefined"),

                        TEXT("Error")

            },

 

    0x00008001

};

 

 

 

#endif

 

 

////////////////////////////////////////////////////////////////////////////////

//          DriverEntry()

//

//          Routine Description:

//

//

//          Arguments:

//         

//         

//          Return Value:

//         

//

 

NTSTATUS

DriverEntry(

    IN PDRIVER_OBJECT   pDriverObject,

    IN PUNICODE_STRING  pRegistryPath)

{   

    return STATUS_SUCCESS;

 

}   //  DriverEntry()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          DllEntry()

//

//          Routine Description:

//

//                      Implement dllentry() function of ndisuio driver under CE.

//

//          Arguments:

//         

//                      hinstDLL          ::           Instance pointer.

//                      Op                               ::           Reason routine is called.

//                      lpvReserved     ::           System parameter.

//         

//          Return Value:

//         

//                      TRUE / FALSE.

//

 

BOOL

DllEntry (HANDLE hinstDLL, DWORD Op, PVOID lpvReserved)

{

            BOOL Status = TRUE;

 

            switch (Op)

            {

                        case DLL_PROCESS_ATTACH:                               

 

#ifdef DEBUG                                     

                                    DEBUGREGISTER(hinstDLL);

#endif

                                    break;

 

                        case DLL_PROCESS_DETACH:                               

                                    break;

 

                        case DLL_THREAD_DETACH :

                                    break;

 

                        case DLL_THREAD_ATTACH :

                                    break;

                                   

                        default :

                                    break;

            }

            return Status;

 

}          // DllEntry()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_Init()

//

//          Routine Description:

//

//                      Called when we call RegisterDevice()

//

//          Arguments:

//                     

//                      Index:: Specifies a pointer to a string containing the registry path

//                                                          to the active key for the stream interface driver.

//         

//          Return Value:

//

//                      Handle to device context created.

//                      This handle is passed to the XXX_Open, XXX_PowerDown, XXX_PowerUp, and

//                      XXX_Deinit functions.

//

 

#define             VALID_DEVICE_CONTEXT            0xCE01CE01

 

DWORD

NPW_Init (DWORD Index)

{

    BOOL    bStatus = TRUE;

 

    do

    {

        HANDLE  hThread;

       

                //

                //      Init global vars used by this object..

                //

 

                InitializeCriticalSection (&g_GlobalCS);

 

        //

        //  Hook into NDISUIO and create thread for NDISUIO notification..

        //  Spin a thread to do that as we don't want to spend too long

        //  in the initialization slowing down the device boot up time.

        //

       

        hThread = CreateThread(

                        NULL,

                        0,

                        NpwStartNotification,

                        NULL,

                        0,

                        NULL);

 

        if (hThread == NULL)

            break;

           

        CloseHandle(hThread);

       

        return (DWORD)VALID_DEVICE_CONTEXT;

    }

    while (FALSE);

 

 

    //

    //  Something has gone wrong..   Bail out..

    //

   

    DeleteCriticalSection(&g_GlobalCS);  

 

    return (DWORD) -1;

 

}          //          NPW_Init()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_Deinit()

//

//          Routine Description:

//

//                      Called when we call DeRegisterDevice()

//

//          Arguments:

//                     

//                      Handle to the device context.

//                      The XXX_Init function creates and returns this identifier.

//

//          Return Value:

//

//                      TRUE indicates success. FALSE indicates failure.

//

 

BOOL

NPW_Deinit(DWORD hDeviceContext)

{

            DEBUGMSG (ZONE_INIT, (TEXT("UIO:: NPW_Deinit()..\r\n")));

 

    DeleteCriticalSection(&g_GlobalCS);

   

            return TRUE;

 

}          //          NPW_Deinit()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_Open()

//

//          Routine Description:

//

//                      This function opens a device for reading and/or writing.

//                      An application indirectly invokes this function when it calls CreateFile

//                      to open special device file names.

//

//          Arguments:

//                     

//          hDeviceContext ::         Handle to the device context. The XXX_Init function

//                                                                      creates and returns this handle.

//         

//          dwAccessCode   ::   Specifies the requested access code of the device. The

//                                                                      access is a combination of read and write.

//

//          dwShareMode    ::   Specifies the requested file share mode of the PC Card

//                                                                      device. The share mode is a combination of file read

//                                                                      and write sharing.

//

//          Return Value:

//

//                      This function returns a handle that identifies the open context of

//                      the device to the calling application

//                      This identifier is passed into the XXX_Read, XXX_Write, XXX_Seek, and

//                      XXX_IOControl functions.

//

 

DWORD

NPW_Open (DWORD hDeviceContext , DWORD dwAccessCode , DWORD dwShareMode)

{

    //

    //  It does not matter..

    //

 

    return 0x01; 

 

}          //          NPW_Open()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_Close()

//

//          Routine Description:

//

//                      Called when app calls closehandle(), or app being terminated..

//

//          Arguments:

//                     

//                      hOpenContext  :: Handle returned by the XXX_Open function, used to

//                                                                      identify the open context of the device.

//

//          Return Value:

//

//                      TRUE indicates success. FALSE indicates failure.

//

 

BOOL

NPW_Close (DWORD hOpenContext) 

{         

    return TRUE;

           

}          //          NPW_Close()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_Write()

//

//          Routine Description:

//

//                      This function writes data to the device.

//

//          Arguments:

//                     

//                      hOpenContext    :: Handle returned by the XXX_Open function, used to

//                                                                                              identify the open context of the device.

//

//                      pSourceBytes    :: Pointer to the buffer that contains the data to write.

//

//                      dwNumberOfBytes :: Specifies the number of bytes to write from the

//                                                                                              pSourceBytes buffer into the device.

//

//          Return Value:

//

//                      The number of bytes written indicates success.

//                      A value of -1 indicates failure

//

 

DWORD

NPW_Write (DWORD hOpenContext , LPCVOID pSourceBytes , DWORD dwNumberOfBytes)

{

    //

    //  Not supported..

    //

 

    return 0x00;

 

}          //          NPW_Write()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_Read()

//

//          Routine Description:

//

//                      This function reads data from the device identified by the open context.

//

//          Arguments:

//                     

//                      hOpenContext    :: Handle returned by the XXX_Open function, used to

//                                                                                              identify the open context of the device.

//

//                      pBuffer         :: Pointer to the buffer which stores the data read

//                                                                                              from the device. This buffer should be at least

//                                                                                              dwCount bytes long.

//

//                      dwCount                                  :: Specifies the number of bytes to write from the

//                                                                                              pSourceBytes buffer into the device.

//

//          Return Value:

//

//                      The number of bytes written indicates success.

//                      A value of -1 indicates failure, 0 indicates time out.

//

//                      GetLastError() will return:

//

//                      STATUS_UNSUCCESSFUL                        

//                                  - Another read is already blocking..

//                                  - Adapter not yet opened via: IOCTL_NDISNPW_OPEN_DEVICE

//                                 

//                      STATUS_INVALID_HANDLE

//                                  - Invalid hOpenContext

//                                  - The adapter object has unbinded.

//

//

 

DWORD

NPW_Read (DWORD hOpenContext, LPVOID pBuffer, DWORD dwCount)

{

    //

    //  Not supported..

    //

 

    return 0x00;

 

 

}          //          NPW_Read

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_Seek()

//

//          Routine Description:

//

//                      This function moves the data pointer in the device.

//

//          Arguments:

//                     

//                      hOpenContext    :: Handle returned by the XXX_Open function, used to

//                                                                                              identify the open context of the device.

//

//                      lAmount                                   :: Specifies the number of bytes to move the data pointer

//                                                                                              in the device. A positive value moves the data

//                                                                                              pointer toward the end of the file, and a

//                                                                                              negative value moves it toward the beginning.

//

//                      wType                          :: Specifies the starting point for the data pointer:

//

//                                                                         FILE_BEGIN

//                                                                                              Indicates that the starting point is 0 or the beginning of the file.

//                                                                         FILE_CURRENT

//                                                                                              Indicates that the current value of the file pointer is the starting point.

//                                                                         FILE_END

//                                                                                              Indicates that the current end-of-file position is the starting point.

//

//          Return Value:

//

//                      The device’s new data pointer indicates success. A value of -1 indicates

//                      failure.

//

 

DWORD

NPW_Seek (DWORD hOpenContext , long lAmount, WORD wType)

{

    //

    //  Not supported..

    //

 

            return -1;

 

}          //          NPW_Seek()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_PowerUp()

//

//          Routine Description:

//

//                      This function restores power to a device.

//

//          Arguments:

//                     

//                      None.

//

//          Return Value:

//

//                      None.

//

 

void

NPW_PowerUp(void)

{

    //

    //  Not supported..

    //

 

            return;

 

}          // NPW_PowerUp()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_PowerDown()

//

//          Routine Description:

//

//                      This function suspends power to the device. It is useful only with

//                      devices that can be shut off under software control.

//                      Such devices are typically, but not exclusively, PC Card devices.

//

//          Arguments:

//                     

//                      None.

//

//          Return Value:

//

//                      None.

//

 

void NPW_PowerDown (void)

{

    //

    //  Not supported..

    //

 

            return;

 

}          //          NPW_PowerDown()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NPW_IOControl()

//

//          Routine Description:

//

//                      This function sends a command to a device.

//

//          Arguments:

//                     

//                      None.

//

//          Return Value:

//

//                      None.

//

 

BOOL

NPW_IOControl(

            DWORD         hOpenContext,

            DWORD         dwCode,

            PBYTE            pBufIn,

            DWORD         dwLenIn,

            PBYTE            pBufOut,

            DWORD         dwLenOut,

            PDWORD       pdwActualOut)

{         

 

    BOOL    bStatus = FALSE;

    PWCHAR  pwcAdapterName;

 

            switch (dwCode)

            {

                        ////////////////////////////////////////////////////////////////////////

 

        case IOCTL_NPW_SAVE_POWER_STATE:

        {

            PNDISPWR_SAVEPOWERSTATE  pSavePowerState;

 

            DEBUGMSG (ZONE_POWERSAVE,

                (TEXT("NdisPower:: IOCTL_NPW_SAVE_POWER_STATE.\r\n")));

 

            if (dwLenIn != sizeof(NDISPWR_SAVEPOWERSTATE))

            {

                SetLastError(ERROR_INVALID_PARAMETER);

                break;

            }

 

            pSavePowerState = (PNDISPWR_SAVEPOWERSTATE) pBufIn;

 

            pwcAdapterName        = MapPtrToProcess(

                                                                                                (PWCHAR)pSavePowerState->pwcAdapterName,

                                                                                                GetCallerProcess());

 

            EnterCriticalSection(&g_GlobalCS);

 

            bStatus = SavePowerState(

                            pwcAdapterName,

                            pSavePowerState->CePowerState);

 

            LeaveCriticalSection(&g_GlobalCS);

 

            break;

        }

 

        ////////////////////////////////////////////////////////////////////////

 

        default:

                                    break;

            }

 

    return bStatus;         

 

}          //          NPW_IOControl()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          SavePowerState()

//

//          Routine Description:

//

//                      This function looks into the registry entry:

//      [HKLM\Comm\NdisPower\<Adapter_Name>].

//      If power state is PwrDeviceUnspecified then it will erase this entry

//      (if entry exists) otherwise it will set the registry entry with this

//      power state..

//     

//          Arguments:

//                     

//                      ptcDeviceName   :: The adapter instance name.

//      CePowerState    :: The power state of the adapter.

//

//          Return Value:

//

//                      TRUE if successful, FALSE otherwise..

//

 

BOOL

SavePowerState(PWCHAR pwcAdapterName, CEDEVICE_POWER_STATE  CePowerState)

{

    HKEY    hkRoot  = NULL;

    BOOL    bStatus = FALSE;

    DWORD   dwErr;   

   

    do

    {

        //

        //  Open or Create the key if it is not already there..

        //

 

        dwErr = RegCreateKeyEx(

                    HKEY_LOCAL_MACHINE,

                    REG_NDISPOWER_ROOT,

                    0x00,

                    NULL,

                    0x00,

                    KEY_WRITE,

                    NULL,

                    &hkRoot,

                    NULL);

 

        if (dwErr != ERROR_SUCCESS)

        {

            DEBUGMSG (ZONE_ERROR,

                (TEXT("NdisPower:: Unable to open/create key [%s]\r\n"),

                REG_NDISPOWER_ROOT));

 

            break;       

        }

 

 

        //

        //  Then set to the non PwrDeviceUnspecified state..

        //

 

        if (CePowerState == PwrDeviceUnspecified)   

        {

            DEBUGMSG (ZONE_POWERSAVE,

                (TEXT("NdisPower:: Adapter was set to PwrDeviceUnspecified, deleting entry for [%s].\r\n"),

                pwcAdapterName));

 

            RegDeleteValue(

                hkRoot,

                pwcAdapterName);

        }

        else

        {

            DEBUGMSG (ZONE_POWERSAVE,

                (TEXT("NdisPower:: Saving power state [%s] for adapter [%s].\r\n"),

                (CePowerState == D0) ? TEXT("D0") :

                (CePowerState == D1) ? TEXT("D1") :

                (CePowerState == D2) ? TEXT("D2") :

                (CePowerState == D3) ? TEXT("D3") :

                (CePowerState == D4) ? TEXT("D3") :

                (CePowerState == PwrDeviceUnspecified) ? TEXT("PwrDeviceUnspecified") : TEXT("Unknown!"),

                pwcAdapterName));

 

            RegSetValueEx(

                hkRoot,

                pwcAdapterName,

                0x00,

                REG_DWORD,

                (PBYTE)&CePowerState,

                sizeof(DWORD));

        }

 

 

        bStatus = TRUE;       

    }

 

    while (FALSE);

 

    if (hkRoot)

        RegCloseKey(hkRoot);

 

    return bStatus;

 

}   //  SavePowerState()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          GetSavedDevicePowerState()

//

//          Routine Description:

//

//                      This function looks into the registry entry:

//      [HKLM\Comm\NdisPower\<Adapter_Name>] for the remembered power state of

//      the device.  

//     

//          Arguments:

//                     

//                      ptcDeviceName   :: The adapter instance name.

//      CePowerState    :: The power state of the adapter.

//

//          Return Value:

//

//                      TRUE if entry is found, FALSE otherwise..

//

 

BOOL

GetSavedDevicePowerState(PTCHAR ptcDeviceName, PCEDEVICE_POWER_STATE pCePowerState)

{

    HKEY    hkRoot = NULL;

    BOOL    bStatus = FALSE;

    DWORD   dwBufferSize, dwType, dwErr;

 

    do

    {

        dwErr = RegOpenKeyEx(

                    HKEY_LOCAL_MACHINE,

                    REG_NDISPOWER_ROOT,

                    0,

                    KEY_READ,

                    &hkRoot);

 

        if (dwErr == ERROR_FILE_NOT_FOUND)

        {

            //

            //  No go..

            //

 

            DEBUGMSG(ZONE_NDISUIO,

                (TEXT("NdisPower:: Reg does not contain [%s]\r\n"),

                REG_NDISPOWER_ROOT));

 

            break;

        }

 

 

        dwBufferSize = sizeof(CEDEVICE_POWER_STATE);

 

        dwErr = RegQueryValueEx(

                    hkRoot,

                    ptcDeviceName,

                    0,

                    &dwType,

                    (LPBYTE)pCePowerState,

                    &dwBufferSize);

 

        if (dwErr != ERROR_SUCCESS || dwType != REG_DWORD)

        {

            DEBUGMSG (ZONE_NDISUIO,

                (TEXT("NdisPower:: Reg does not contain entry for [%s]..\r\n"),

                ptcDeviceName));

 

            break;

        }

 

        //

        //  Everything is OKAY..

        //

 

        DEBUGMSG (ZONE_NDISUIO,

            (TEXT("NdisPower:: Adapter [%s] - Saved Power State [%s].\r\n"),

            ptcDeviceName,

            (*pCePowerState == D0) ? TEXT("D0") :

            (*pCePowerState == D1) ? TEXT("D1") :

            (*pCePowerState == D2) ? TEXT("D2") :

            (*pCePowerState == D3) ? TEXT("D3") :

            (*pCePowerState == D4) ? TEXT("D4") :

            (*pCePowerState == PwrDeviceUnspecified) ? TEXT("PwrDeviceUnspecified") :           

            TEXT("UNKNOWN!")));

 

        bStatus = TRUE;

 

    }

    while (FALSE);

 

    if (hkRoot)

        RegCloseKey(hkRoot);

 

    return bStatus;

 

}   //  GetSavedDevicePowerState()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//  DoNdisIOControl()

//

//  Routine Description:

//

//      This function sends the dwCommand IOCTL to NDIS.

//

//

//  Return Value:

//

//      TRUE if successful, FALSE otherwise..

//

 

BOOL

DoNdisIOControl(

        DWORD   dwCommand,

        LPVOID  pInBuffer,

        DWORD   cbInBuffer,

        LPVOID  pOutBuffer,

        DWORD   *pcbOutBuffer)

{

   HANDLE   hNdis;

   BOOL     bResult = FALSE;

 

   hNdis =  CreateFile(

                DD_NDIS_DEVICE_NAME,

                GENERIC_READ | GENERIC_WRITE,

                FILE_SHARE_READ | FILE_SHARE_WRITE,

                NULL,

                OPEN_ALWAYS,

                0,

                NULL);

 

   if (INVALID_HANDLE_VALUE != hNdis)

   {

      bResult = DeviceIoControl(

                    hNdis,

                    dwCommand,

                    pInBuffer,

                    cbInBuffer,

                    pOutBuffer,

                    (pcbOutBuffer ? *pcbOutBuffer : 0x00),

                    pcbOutBuffer,

                    NULL);

                   

        CloseHandle(hNdis);

   }

 

   return bResult;

  

}

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          SetAdapterPowerState()

//

//          Routine Description:

//

//                      This function looks into the registry entry:

//      [HKLM\Comm\NdisPower\<Adapter_Name>] for the remembered power state of

//      the device.   If entry is not found, do nothing.

// 

//      Up to CE 4.0, the PCMCIA power on for network adapters emulates

//      card ejection and re-insertion.

//      Thus the power state of the device is not remembered by Power Manager.

//      Hence this module reinstate the state..

//     

//          Arguments:

//                     

//                      ptcDeviceName   :: The adapter instance name.

//

//          Return Value:

//

//                      TRUE if the adapter is disabled, FALSE otherwise.

//

 

BOOL

SetAdapterPowerState(PTCHAR ptcDeviceName)

{  

   

    CEDEVICE_POWER_STATE    CePowerState;

    BOOL                    bSetDisabled = FALSE;

 

    //

    //  See if there is a saved device power state, if so set it.

    //

 

    if (GetSavedDevicePowerState(ptcDeviceName, &CePowerState))

    {

        //

        //  If it is not PwrDeviceUnspecified then issue the power state through PM..

        //  We do this regardless of whether the actual adapter is power manageable.

        //  Failure is okay, we'll unbind it just like connmc.exe does.

        // 

 

        if (CePowerState != PwrDeviceUnspecified)

        {

            TCHAR szName[MAX_PATH];

            int   nChars;

 

            RETAILMSG (1, (TEXT("NDISPWR:: Disabling adapter [%s]\r\n"),

                ptcDeviceName));

 

            nChars = _sntprintf(

                        szName,

                        MAX_PATH-1,

                        _T("%s\\%s"),

                        PMCLASS_NDIS_MINIPORT,

                        ptcDeviceName);

 

 

            if (nChars != -1)

            {

                DEBUGMSG (ZONE_NDISUIO,

                    (TEXT("NdisPower:: Setting adapter [%s] to Power State [%s].\r\n"),

                    ptcDeviceName,

                    (CePowerState == D0) ? TEXT("D0") :

                    (CePowerState == D1) ? TEXT("D1") :

                    (CePowerState == D2) ? TEXT("D2") :

                    (CePowerState == D3) ? TEXT("D3") :

                    (CePowerState == D4) ? TEXT("D4") :

                    (CePowerState == PwrDeviceUnspecified) ? TEXT("PwrDeviceUnspecified") :                   

                    TEXT("UNKNOWN!")));

 

                SetDevicePower(szName, POWER_NAME, CePowerState);

 

            }

 

            //

            //  IOCTL_NDIS_UNBIND_ADAPTER takes multisz (protocol driver names

            //  follow the adapter name) hence we need extra NULL.

            //

           

            memset (szName, 0x00, sizeof(szName));

            _tcscpy(szName, ptcDeviceName);

            DoNdisIOControl(

                IOCTL_NDIS_UNBIND_ADAPTER,

                szName,

                (_tcslen(ptcDeviceName)+2) * sizeof(TCHAR),

                NULL,

                NULL);

 

            bSetDisabled = TRUE;

            

        }

    }

 

    return bSetDisabled;

   

}   //  SetAdapterPowerState()

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NpwNotificationThread()

//

//          Routine Description:

//

//                      The thread that handles notification from NDISUIO..

//

//          Arguments:

//                     

//                      None.

//

//          Return Value:

//

//                      None.

//

 

DWORD

NpwNotificationThread(LPVOID pUnused)

{

            NDISUIO_DEVICE_NOTIFICATION                      sDeviceNotification;

            DWORD                                                                                 dwBytesReturned;

            DWORD                                                                                 dwFlags;

 

 

    //

    //  Wait till PM is ready..  or NDIS has registered its

    //  adapters..

    //

 

    while(!IsAPIReady(SH_SHELL))

        Sleep(500);

 

 

    while (WaitForSingleObject(g_hMsgQueue, INFINITE) == WAIT_OBJECT_0)

    {

            while (ReadMsgQueue(

                                                g_hMsgQueue,

                                                &sDeviceNotification,

                                                sizeof(NDISUIO_DEVICE_NOTIFICATION),

                                                &dwBytesReturned,

                                                1,

                                                &dwFlags))

            {

                        //

                        //          Okay, we have notification.. 

                        //

                       

                        DEBUGMSG(ZONE_NDISUIO,

                                    (TEXT("NdisPower:: Notification:: Event [%s] \t Adapter [%s]\r\n"),                                        

                                    (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_RESET_START)

                                                ?          TEXT("RESET_START")                                :

                                    (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_RESET_END)

                                                ?          TEXT("RESET_END")                                    :

                                    (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_MEDIA_CONNECT)

                                                ?          TEXT("MEDIA_CONNECT")                        :

                                    (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_MEDIA_DISCONNECT)

                                                ?          TEXT("MEDIA_DISCONNECT")      :

                                    (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_BIND)

                                                ?          TEXT("BIND")                                                            :

                                    (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_UNBIND)

                                                ?          TEXT("UNBIND")                                          :

                                    (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_ADAPTER_ARRIVAL)

                                                ?          TEXT("ADAPTER_ARRIVAL")                     :

                                    (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_ADAPTER_REMOVAL)

                                                ?          TEXT("ADAPTER_REMOVAL")                   :

                                    (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_LINK_SPEED_CHANGE)

                                                ?          TEXT("SPEED_CHANGE")                            :

                                    TEXT("Unknown!"),

                                    sDeviceNotification.ptcDeviceName));

 

 

                                    //                                             

                                    //          This is what we do to the notification:

                                    //

 

            if (sDeviceNotification.dwNotificationType & NDISUIO_NOTIFICATION_BIND)

            {

                //

                //  Give NDIS some times to bind all the protocols to this adapter

                //  before we issue unbind if necessary...

                //

 

                RETAILMSG (1,

                    (TEXT("NDISPWR:: BIND notification for adapter [%s]\r\n"),

                    sDeviceNotification.ptcDeviceName));

               

                Sleep(2000);

                                        SetAdapterPowerState(sDeviceNotification.ptcDeviceName);

            }

           

                        }         

           

            }         

 

            return 0x00;

 

}          //          NpwNotificationThread

 

 

 

////////////////////////////////////////////////////////////////////////////////

//          NpwStartNotification()

//

//          Routine Description:

//

//                      This function register with NDISUIO and request for notification..

//

//          Arguments:

//                     

//                      None.

//

//          Return Value:

//

//                      TRUE if successful, FALSE otherwise..

//

 

BOOL

NpwStartNotification(LPVOID pUnused)

{

    #define         NOTIFICATION_REQUIRED           \

                                    NDISUIO_NOTIFICATION_BIND                         

 

    //

    //      CE does not have WMI, so NDISUIO's IOCTL_NDISUIO_REQUEST_NOTIFICATION

    //      handles it for us..

    //      Once created, we never shut down, since we don't have the SCM

    //      equivalent..

    //     

 

    MSGQUEUEOPTIONS                                                      sOptions;                                 

    NDISUIO_REQUEST_NOTIFICATION   sRequestNotification;

    HANDLE                                                                            hThread;

    BOOL                                                                                 bStatus = FALSE;

 

 

    //

    //  Wait till PM is ready..  or NDIS has registered its

    //  adapters..

    //

 

    while(!IsAPIReady(SH_SHELL))

        Sleep(500);

     

    do

    {

        //

        //  First stop is to get a handle to NDISUIO..

        //

 

        DWORD   dwErr = ERROR_SUCCESS;

 

        char                    Buffer[1024];

        PNDISUIO_QUERY_BINDING  pQueryBinding;

        DWORD                   dwOutSize, i = 0x00;

 

        //

        //  Note the Desired Access is zero..

        //  This handle can only do Write/Query.

        //

 

        g_hNdisuio = CreateFile(

                        (PTCHAR)NDISUIO_DEVICE_NAME,                                  //          Object name.

                        0x00,                                                         //          Desired access.

                        0x00,                                                         //          Share Mode.

                        NULL,                                                         //          Security Attr

                        OPEN_EXISTING,                    

                        FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,       // Flag and Attributes..

                        (HANDLE)INVALID_HANDLE_VALUE);  

 

        if (g_hNdisuio == INVALID_HANDLE_VALUE)

        {

            dwErr = GetLastError();

            DEBUGMSG (ZONE_ERROR,

                (TEXT("NdisPower:: Unable to open [%s]\r\n"),

                NDISUIO_DEVICE_NAME));

 

            break;

        }

 

 

        //

        //  Check out the interfaces that have been instantiated before

        //  we get launched... (IOCTL_NDISUIO_REQUEST_NOTIFICATION will only

        //  give notification for devices arriving in the future).

        //

 

        do

        {

            PTCHAR  pAdapterName;

           

            pQueryBinding = (PNDISUIO_QUERY_BINDING)&Buffer[0];

           

            memset(pQueryBinding, 0x00, sizeof(NDISUIO_QUERY_BINDING));

                       

            pQueryBinding->BindingIndex = i;

           

            if (!DeviceIoControl(

                    g_hNdisuio,

                    IOCTL_NDISUIO_QUERY_BINDING,

                    pQueryBinding,

                    sizeof(NDISUIO_QUERY_BINDING),

                    pQueryBinding,

                    1024,

                    &dwOutSize,

                    NULL))

            {

                break;

            }

           

            //

            //  Make sure it's terminated..

            //

 

            pAdapterName = (PTCHAR)&Buffer[pQueryBinding->DeviceNameOffset];

            pAdapterName[(pQueryBinding->DeviceNameLength / sizeof(TCHAR)) - 1] = 0x00;

 

            RETAILMSG (1,

                (TEXT("NDISPWR:: Found adapter [%s]\r\n"),

                pAdapterName));

 

            //

            //  If the adapter was unbind, then this will change the

            //  NDISUIO internal queue, and we may hence miss potentially miss

            //  out the next adapter.

            //  So if SetAdapterPowerState() decides to disable the adapter

            //  then we will reset our count.

            //

           

            if (SetAdapterPowerState(pAdapterName))

            {

                i = 0x00;                

            }           

            else

            {

                i++;

            }

        }

        while(TRUE);

 

                        //

                        //          Then create the msg queue..

                        //

 

                        sOptions.dwSize                                                           = sizeof(MSGQUEUEOPTIONS);

                        sOptions.dwFlags                                             = 0;

                        sOptions.dwMaxMessages                               = 4;

                        sOptions.cbMaxMessage                                 = sizeof(NDISUIO_DEVICE_NOTIFICATION);

                        sOptions.bReadAccess                         = TRUE;

 

                        g_hMsgQueue = CreateMsgQueue(NULL,&sOptions);

 

                        if (g_hMsgQueue == NULL)                                       

                        {

                                    DEBUGMSG (ZONE_ERROR,

                                                (TEXT("NdisPower:: Error CreateMsgQueue()..\r\n")));

                                    break;

                        }

                       

 

                        //

                        //          Queue created successfully, tell NDISUIO about it..                             

                        //

 

                        sRequestNotification.hMsgQueue                                             = g_hMsgQueue;

                        sRequestNotification.dwNotificationTypes        = NOTIFICATION_REQUIRED;

 

                        if (!DeviceIoControl(

                                                g_hNdisuio,

                                                IOCTL_NDISUIO_REQUEST_NOTIFICATION,

                                                &sRequestNotification,

                                                sizeof(NDISUIO_REQUEST_NOTIFICATION),

                                                NULL,

                                                0x00,

                                                NULL,

                                                NULL))

                        {

                                    DEBUGMSG (ZONE_ERROR,

                                                (TEXT("NdisPower:: Err IOCTL_NDISUIO_REQUEST_NOTIFICATION\r\n")));

                                    break;

                        }

 

                        //

                        //          NDISUIO takes it well, now party on it..

                        //

 

                        hThread = CreateThread(

                                                                        NULL,

                                                                        0,

                                                                        NpwNotificationThread,

                                                                        NULL,

                                                                        0,

                                                                        NULL);

 

        CloseHandle(hThread);

 

                        //

                        //          Everything is cool..

                        //

 

                        DEBUGMSG (ZONE_INIT,

                                    (TEXT("NdisPower:: Successfully register for notification!\r\n")));

 

        bStatus = TRUE;

 

            }

            while (FALSE);

 

 

    if (!bStatus)

    {

        if (g_hMsgQueue)

            CloseMsgQueue(g_hMsgQueue);

 

        if (g_hNdisuio)

            CloseHandle(g_hNdisuio);

    }

 

            return bStatus;

 

}          //          NpwStartNotification

 

Component:  CPLMAIN

The following code change will resolve this issue.  Listed below is the function that needs to be changed - first is BEFORE, second is AFTER.  Changes and additions are noted in BOLD, deletions are noted in RED.

 

FILE:  PUBLIC\WCESHELLFE\OAK\CTLPNL\CPLMAIN\SCREEN.CPP

 

In function BackgroundDlgProc(), case IDC_TILEIMAGE:

 

 

BEFORE

 

        case IDC_TILEIMAGE:
                m_fChanged = TRUE;
                InvalidateRect(DI(IDC_BOX), NULL, TRUE); // force a repaint
                return TRUE;
 

AFTER

 

        case IDC_TILEIMAGE:
                m_fChanged = TRUE;
                m_fTile = Button_GetCheck(DI(IDC_TILEIMAGE));
                InvalidateRect(DI(IDC_BOX), NULL, TRUE); // force a repaint
                return TRUE;
 

  • 020814_Q327506 - When a user tries to set a bitmap as the desktop background image that is not currently on the list of available images (the bitmap files in the Windows directory), the display control panel fails on exit, and does not change the bitmap.

The following code change will resolve this issue.  Listed below is the function that needs to be changed - first is BEFORE, second is AFTER.  Changes and additions are noted in BOLD, deletions are noted in RED.

 

FILE:  PUBLIC\WCESHELLFE\OAK\CTLPNL\CPLMAIN\CPLUTILS.CPP

 

In function CFileCombo::AddFile():

 

BEFORE

 

    int CFileCombo::AddFile(LPCTSTR szDir, LPCTSTR szFile)
    {
            TCHAR szTemp[MAX_PATH+5];
                int iIndex;
                LPTSTR pszData;
  
                // insert prettied up name into combobox
                if(!szDir || !szFile) {
                        return CB_ERR;
                }

                StringCbCopy(szTemp, sizeof(szTemp), szFile);

                MakeNameNice(szTemp);
                if(CB_ERR == (iIndex = ComboBox_AddString(m_hwndCB, szTemp)))
                        return CB_ERR;

                szTemp[0] = 0;

                lstrcpy(szTemp, szDir);
                lstrcat(szTemp, BACKSLASH);

                lstrcat(szTemp, szFile);
                pszData = MySzDup(szTemp); // freed in destructor

                // associate fullpath as data
                if(CB_ERR == ComboBox_SetItemData(m_hwndCB, iIndex, pszData)) {
                        ASSERT(FALSE);
                        MyFree(pszData);
                        return CB_ERR;
                }
            return iIndex;
    }

 

 

AFTER

 

    int CFileCombo::AddFile(LPCTSTR szDir, LPCTSTR szFile)
    {
            TCHAR szTemp[MAX_PATH+5];
                int iIndex;
                LPTSTR pszData;
  
                // insert prettied up name into combobox
                if(!szFile) {
                        return CB_ERR;
                }

                StringCbCopy(szTemp, sizeof(szTemp), szFile);

                MakeNameNice(szTemp);
                if(CB_ERR == (iIndex = ComboBox_AddString(m_hwndCB, szTemp)))
                        return CB_ERR;

                szTemp[0] = 0;

                if(szDir) {

                        lstrcpy(szTemp, szDir);
                        lstrcat(szTemp, BACKSLASH);
                    }


                lstrcat(szTemp, szFile);
                pszData = MySzDup(szTemp); // freed in destructor

                // associate fullpath as data
                if(CB_ERR == ComboBox_SetItemData(m_hwndCB, iIndex, pszData)) {
                        ASSERT(FALSE);
                        MyFree(pszData);
                        return CB_ERR;
                }
            return iIndex;
    }

 

Component:  GWES

The following two code changes will fully implement this fix.  Listed below are the files and functions that need to be changed - first is BEFORE, second is AFTER.  Changes and additions are noted in BOLD, deletions are noted in RED.

 

 

FILE:  PLATFORM\CEPC\KERNEL\HAL\OEMIOCTL.C

 

Function: OEMIoControl():

 

BEFORE:

 

case IOCTL_HAL_POSTINIT:

        // Initialize critical sections

        InitializeCriticalSection(&csPCIConfig);

        InitializeCriticalSection(&RTC_critsect);

        InitializeCriticalSection(&csRequestSysIntr);

 

        // Notify EDBG that RTC is available

        fRTCInit = TRUE;

       

        return TRUE;

       

    default:

#ifdef INTERNAL_HAL_TESTING

        return InternalHalTesting(dwIoControlCode, lpInBuf, nInBufSize, lpOutBuf, nOutBufSize, lpBytesReturned);

#else

        SetLastError(ERROR_NOT_SUPPORTED);

        return FALSE;

#endif

    }

   

    return retval;

}

 

AFTER:

 

    case IOCTL_HAL_POSTINIT:

        // Initialize critical sections

        InitializeCriticalSection(&csPCIConfig);

        InitializeCriticalSection(&RTC_critsect);

        InitializeCriticalSection(&csRequestSysIntr);

 

        // Notify EDBG that RTC is available

        fRTCInit = TRUE;

       

        return TRUE;

 

    case IOCTL_HAL_QUERY_DISPLAYSETTINGS:

        if (lpBytesReturned) {

            *lpBytesReturned = 0;

        }

 

        if (!lpOutBuf) {

            SetLastError(ERROR_INVALID_PARAMETER);

        } else if (sizeof(DWORD)*3 > nOutBufSize) {

            SetLastError(ERROR_INSUFFICIENT_BUFFER);

        } else {

            // Check the boot arg structure for the default display settings.

 

            PBOOT_ARGS args;

 

            args = (PBOOT_ARGS)(*(PBYTE *)BOOT_ARG_PTR_LOCATION);

 

            if (0 != args) {

                args = (PBOOT_ARGS)((DWORD)args | 0x80000000);

 

                __try {

                    if (BOOTARG_SIG == args->dwSig) {

 

                        ((PDWORD)lpOutBuf)[0] = (DWORD)args->cxDisplayScreen;

                        ((PDWORD)lpOutBuf)[1] = (DWORD)args->cyDisplayScreen;

                        ((PDWORD)lpOutBuf)[2] = (DWORD)args->bppScreen;

 

                        if (lpBytesReturned) {

                            *lpBytesReturned = sizeof (DWORD) * 3;

                        }

 

                        return TRUE;

                    }

                } __except (EXCEPTION_EXECUTE_HANDLER) {

                    SetLastError(ERROR_INVALID_PARAMETER);

                }

            }

        }

 

        return FALSE;       

    default:

#ifdef INTERNAL_HAL_TESTING

        return InternalHalTesting(dwIoControlCode, lpInBuf, nInBufSize, lpOutBuf, nOutBufSize, lpBytesReturned);

#else

        SetLastError(ERROR_NOT_SUPPORTED);

        return FALSE;

#endif

    }

   

    return retval;

}

 

 

 

FILE:  PUBLIC\COMMON\OAK\INC\PKFUNCS.H

 

BEFORE:

 

// Kernel IOCTLs based on FILE_DEVICE_HAL -- last ID used is 61.
#define IOCTL_HAL_GET_DEVICE_INFO CTL_CODE(FILE_DEVICE_HAL, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_GET_IP_ADDR CTL_CODE(FILE_DEVICE_HAL, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_RADIO_CNTRL CTL_CODE(FILE_DEVICE_HAL, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_DDK_CALL CTL_CODE(FILE_DEVICE_HAL, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_EDBG_REGISTER_CLIENT CTL_CODE(FILE_DEVICE_HAL, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_DEREGISTER_CLIENT CTL_CODE(FILE_DEVICE_HAL, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_REGISTER_DFLT_CLIENT CTL_CODE(FILE_DEVICE_HAL, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_SEND CTL_CODE(FILE_DEVICE_HAL, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_RECV CTL_CODE(FILE_DEVICE_HAL, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_SET_DEBUG CTL_CODE(FILE_DEVICE_HAL,11, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_SET_KERNEL_COMM_DEV CTL_CODE(FILE_DEVICE_HAL, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_GET_UUID CTL_CODE(FILE_DEVICE_HAL, 13, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_INIT_RTC CTL_CODE(FILE_DEVICE_HAL, 14, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_SET_KERNEL_DEV_PORT CTL_CODE(FILE_DEVICE_HAL, 17, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_TRANSLATE_IRQ CTL_CODE(FILE_DEVICE_HAL, 18, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_GET_RIO_INFO CTL_CODE(FILE_DEVICE_HAL, 19, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_ILTIMING CTL_CODE(FILE_DEVICE_HAL, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_GET_DEVICEID CTL_CODE(FILE_DEVICE_HAL, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_PROFILE CTL_CODE(FILE_DEVICE_HAL, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_SET_DEVICE_INFO CTL_CODE(FILE_DEVICE_HAL, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_QUERY_PHYSICALMEM CTL_CODE(FILE_DEVICE_HAL, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_PROCESSOR_INFORMATION CTL_CODE(FILE_DEVICE_HAL, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_GETREGSECUREKEYS CTL_CODE(FILE_DEVICE_HAL, 35, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_REQUEST_IRQ CTL_CODE(FILE_DEVICE_HAL, 36, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_REQUEST_SYSINTR CTL_CODE(FILE_DEVICE_HAL, 38, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_RELEASE_SYSINTR CTL_CODE(FILE_DEVICE_HAL, 54, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to get KITL transport info
#define IOCTL_KITL_GET_INFO CTL_CODE(FILE_DEVICE_HAL, 37, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_ENABLE_WAKE CTL_CODE(FILE_DEVICE_HAL, 40, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_DISABLE_WAKE CTL_CODE(FILE_DEVICE_HAL, 41, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_GET_WAKE_SOURCE CTL_CODE(FILE_DEVICE_HAL, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_AUTOWAKEUP CTL_CODE(FILE_DEVICE_HAL, 43, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_PRESUSPEND CTL_CODE(FILE_DEVICE_HAL, 61, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to tell OEM to initialize registry on boot
#define IOCTL_HAL_INITREGISTRY CTL_CODE(FILE_DEVICE_HAL, 44, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to give OEM a more full-featured init when the kernel is ready to go
// and before any apps are started
#define IOCTL_HAL_POSTINIT CTL_CODE(FILE_DEVICE_HAL, 45, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to ask OEM whether to force clean registry hive
#define IOCTL_HAL_GET_HIVE_CLEAN_FLAG CTL_CODE(FILE_DEVICE_HAL, 49, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to ask OEM the reason for power on
#define IOCTL_HAL_GET_POWERONREASON CTL_CODE(FILE_DEVICE_HAL, 50, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to get random hardware seed
#define IOCTL_HAL_GET_RANDOM_SEED CTL_CODE(FILE_DEVICE_HAL, 52, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to ask OEM for a RAM region to put the registry hive into
#define IOCTL_HAL_GET_HIVE_RAM_REGION CTL_CODE(FILE_DEVICE_HAL, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to tell OEM to save the RAM region where the registry hive is stored
#define IOCTL_HAL_SAVE_HIVE_RAM_REGION CTL_CODE(FILE_DEVICE_HAL, 55, METHOD_BUFFERED, FILE_ANY_ACCESS)


// IOCTL to write XIP section.
#define IOCTL_HAL_WRITE_XIP CTL_CODE(FILE_DEVICE_HAL, 46, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_XIPCHAIN CTL_CODE(FILE_DEVICE_HAL, 47, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL for authenticate device
#define IOCTL_HAL_AUTHENTICATE_DEVICE CTL_CODE(FILE_DEVICE_HAL, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL for WHQL testing (used to check whether hardware is in a jumpered test mode).
#define IOCTL_HAL_WHQL_TEST_MODE CTL_CODE(FILE_DEVICE_HAL, 56, METHOD_BUFFERED, FILE_ANY_ACCESS)

 

 

AFTER:

 

// Kernel IOCTLs based on FILE_DEVICE_HAL -- last ID used is 63.
#define IOCTL_HAL_GET_DEVICE_INFO CTL_CODE(FILE_DEVICE_HAL, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_GET_IP_ADDR CTL_CODE(FILE_DEVICE_HAL, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_RADIO_CNTRL CTL_CODE(FILE_DEVICE_HAL, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_DDK_CALL CTL_CODE(FILE_DEVICE_HAL, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_EDBG_REGISTER_CLIENT CTL_CODE(FILE_DEVICE_HAL, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_DEREGISTER_CLIENT CTL_CODE(FILE_DEVICE_HAL, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_REGISTER_DFLT_CLIENT CTL_CODE(FILE_DEVICE_HAL, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_SEND CTL_CODE(FILE_DEVICE_HAL, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_RECV CTL_CODE(FILE_DEVICE_HAL, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_EDBG_SET_DEBUG CTL_CODE(FILE_DEVICE_HAL,11, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_SET_KERNEL_COMM_DEV CTL_CODE(FILE_DEVICE_HAL, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_GET_UUID CTL_CODE(FILE_DEVICE_HAL, 13, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_INIT_RTC CTL_CODE(FILE_DEVICE_HAL, 14, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_SET_KERNEL_DEV_PORT CTL_CODE(FILE_DEVICE_HAL, 17, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_TRANSLATE_IRQ CTL_CODE(FILE_DEVICE_HAL, 18, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_GET_RIO_INFO CTL_CODE(FILE_DEVICE_HAL, 19, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_ILTIMING CTL_CODE(FILE_DEVICE_HAL, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_GET_DEVICEID CTL_CODE(FILE_DEVICE_HAL, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_PROFILE CTL_CODE(FILE_DEVICE_HAL, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_SET_DEVICE_INFO CTL_CODE(FILE_DEVICE_HAL, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_QUERY_PHYSICALMEM CTL_CODE(FILE_DEVICE_HAL, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_PROCESSOR_INFORMATION CTL_CODE(FILE_DEVICE_HAL, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_GETREGSECUREKEYS CTL_CODE(FILE_DEVICE_HAL, 35, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_REQUEST_IRQ CTL_CODE(FILE_DEVICE_HAL, 36, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_REQUEST_SYSINTR CTL_CODE(FILE_DEVICE_HAL, 38, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_RELEASE_SYSINTR CTL_CODE(FILE_DEVICE_HAL, 54, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to get KITL transport info
#define IOCTL_KITL_GET_INFO CTL_CODE(FILE_DEVICE_HAL, 37, METHOD_BUFFERED, FILE_ANY_ACCESS)

#define IOCTL_HAL_ENABLE_WAKE CTL_CODE(FILE_DEVICE_HAL, 40, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_DISABLE_WAKE CTL_CODE(FILE_DEVICE_HAL, 41, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_GET_WAKE_SOURCE CTL_CODE(FILE_DEVICE_HAL, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_AUTOWAKEUP CTL_CODE(FILE_DEVICE_HAL, 43, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_PRESUSPEND CTL_CODE(FILE_DEVICE_HAL, 61, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to tell OEM to initialize registry on boot
#define IOCTL_HAL_INITREGISTRY CTL_CODE(FILE_DEVICE_HAL, 44, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to give OEM a more full-featured init when the kernel is ready to go
// and before any apps are started
#define IOCTL_HAL_POSTINIT CTL_CODE(FILE_DEVICE_HAL, 45, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to ask OEM whether to force clean registry hive
#define IOCTL_HAL_GET_HIVE_CLEAN_FLAG CTL_CODE(FILE_DEVICE_HAL, 49, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to ask OEM the reason for power on
#define IOCTL_HAL_GET_POWERONREASON CTL_CODE(FILE_DEVICE_HAL, 50, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to get random hardware seed
#define IOCTL_HAL_GET_RANDOM_SEED CTL_CODE(FILE_DEVICE_HAL, 52, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to ask OEM for a RAM region to put the registry hive into
#define IOCTL_HAL_GET_HIVE_RAM_REGION CTL_CODE(FILE_DEVICE_HAL, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to tell OEM to save the RAM region where the registry hive is stored
#define IOCTL_HAL_SAVE_HIVE_RAM_REGION CTL_CODE(FILE_DEVICE_HAL, 55, METHOD_BUFFERED, FILE_ANY_ACCESS)


// IOCTL to write XIP section.
#define IOCTL_HAL_WRITE_XIP CTL_CODE(FILE_DEVICE_HAL, 46, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_HAL_XIPCHAIN CTL_CODE(FILE_DEVICE_HAL, 47, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL for authenticate device
#define IOCTL_HAL_AUTHENTICATE_DEVICE CTL_CODE(FILE_DEVICE_HAL, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL for WHQL testing (used to check whether hardware is in a jumpered test mode).
#define IOCTL_HAL_WHQL_TEST_MODE CTL_CODE(FILE_DEVICE_HAL, 56, METHOD_BUFFERED, FILE_ANY_ACCESS)

// IOCTL to query for a default display resolution.
#define IOCTL_HAL_QUERY_DISPLAYSETTINGS CTL_CODE(FILE_DEVICE_HAL, 63, METHOD_BUFFERED, FILE_ANY_ACCESS)

 

Component:  NETUI

The following two code changes will resolve this issue.  Listed below is the function that needs to be changed - first is BEFORE, second is AFTER.  Changes and additions are noted in BOLD, deletions are noted in RED.

 

FILE:  PUBLIC\COMMON\OAK\DRIVERS\NETUI\WZCPROPS.C

 

In function NetworkWLanPropsDlgProc()

 

BEFORE:

 

            if (pWCP->wzcConfig.Ssid.SsidLength != 0) {

                // ugly but this is life. In order to convert the SSID to LPWSTR we need a buffer.

                // We know an SSID can't exceed 32 chars (see NDIS_802_11_SSID from ntddndis.h) so

                // make room for the null terminator and that's it. We could do mem alloc but I'm

                // not sure it worth the effort (at runtime).

                WCHAR   wszSSID[33];

 

                // convert the LPSTR (original SSID format) to LPWSTR (needed in List Ctrl)

                if (MultiByteToWideChar(

                                       CP_ACP,

                                       0,

                                       (LPCSTR)pWCP->wzcConfig.Ssid.Ssid,

                                       pWCP->wzcConfig.Ssid.SsidLength,

                                       wszSSID,

                                       ARRAYSIZE(wszSSID)) != 0) {

                    wszSSID[pWCP->wzcConfig.Ssid.SsidLength] = L'\0';

                    SetWindowText(pWCP->hwndEdSSID, wszSSID);

                }

            }

 

            // Check the "this network is adhoc" box if neccessary.

            SendMessage(pWCP->hwndChkAdhoc, BM_SETCHECK, (pWCP->wzcConfig.InfrastructureMode == Ndis802_11IBSS) ? BST_CHECKED : BST_UNCHECKED, 0);

 

            // Check the "Use the network key to access this network" checkbox if necessary

            // Checking this corresponds to "Shared" auth mode. Unchecked corresponds to "Open" (dsheldon)

            SendMessage(pWCP->hwndChkShared, BM_SETCHECK, pWCP->wzcConfig.AuthenticationMode ? BST_CHECKED : BST_UNCHECKED, 0);

 

            // the SSID can't be under any circumstances larger than 32 chars

            SendMessage(pWCP->hwndEdSSID, EM_LIMITTEXT, 32, 0);

 

            SendMessage(pWCP->hwndUsePW, BM_SETCHECK, (pWCP->wzcConfig.Privacy == 1) ? BST_CHECKED : BST_UNCHECKED, 0);

 

            // enable or disable the controls based on how the dialog is called

            EnableWindow(pWCP->hwndEdSSID, pWCP->dwFlags & WZCDLG_PROPS_RWSSID);

            EnableWindow(pWCP->hwndChkAdhoc, pWCP->dwFlags & WZCDLG_PROPS_RWINFR);

            EnableWindow(pWCP->hwndChkShared, pWCP->dwFlags & WZCDLG_PROPS_RWAUTH);

            EnableWindow(pWCP->hwndUsePW, pWCP->dwFlags & WZCDLG_PROPS_RWWEP);

           

            // check whether the "Wire Equivalent Privacy key" needs to be checked

            CheckDlgButton(hDlg,IDC_USEHARDWAREPW,

                           (pWCP->wzcConfig.dwCtlFlags & WZCCTL_WEPK_PRESENT) ? BST_UNCHECKED : BST_CHECKED);

 

            // Enable/disable WEP controls

            EnableWepKControls(hDlg, pWCP);

 

            // Enable/disable 802.1x controls

            if ((Init8021xControls(hDlg,pWCP) != ERROR_SUCCESS) || !(pWCP->dwFlags & WZCDLG_PROPS_RW8021X)) {

                EnableWindow(pWCP->hwndChkEnable8021x, FALSE);

                EnableWindow(pWCP->hwndCbEAPType, FALSE);

                EnableWindow(pWCP->hwndBtnEAPProps, FALSE);

            }

            else {

                Enable8021xControls(hDlg,pWCP);

            }

 

            // at this point we can say the WEP key is untouched

            pWCP->bKMatTouched = FALSE;

        }

        break;

 

    case WM_COMMAND :

       

        wCmdId  = LOWORD(wParam);

        wCmdCbn = HIWORD(wParam);

 

            pWCP = (WLAN_CFG_PROPS *) GetWindowLong (hDlg, GWL_USERDATA);

        if (pWCP == NULL)

            return FALSE;

 

        switch ( wCmdId ) {

       

        case IDCANCEL:

            Cleanup8021xControls(pWCP);

 

            EndDialog(hDlg,IDCANCEL);

            break;

 

        case IDOK:

            {

                UINT nSSIDLen;

                // variables used for prompting the user with warning/err messages

                UINT  nWarnStringID = 0;

                WCHAR wszWarn1[48], wszWarn2[48];

 

                pWCP->wzcConfig.Length = sizeof(WZC_WLAN_CONFIG);

                pWCP->wzcConfig.InfrastructureMode = (BST_CHECKED == SendMessage(pWCP->hwndChkAdhoc, BM_GETCHECK, 0, 0)) ? Ndis802_11IBSS : Ndis802_11Infrastructure;

                pWCP->wzcConfig.AuthenticationMode = (BST_CHECKED == SendMessage(pWCP->hwndChkShared, BM_GETCHECK, 0, 0)) ? Ndis802_11AuthModeShared : Ndis802_11AuthModeOpen;

                pWCP->wzcConfig.Privacy = (BYTE) (BST_CHECKED == SendMessage(pWCP->hwndUsePW, BM_GETCHECK, 0, 0)) ? 1 : 0;

 

                // get the ssid (max 32 chars)

                {

                    WCHAR wszSSID[33];

                    nSSIDLen = GetWindowText(

                                             pWCP->hwndEdSSID,

                                             wszSSID,

                                             ARRAYSIZE(wszSSID));

 

                    // copy over whatever it is in the control to the ndis data structure

                    if (nSSIDLen &&

                        WideCharToMultiByte(CP_ACP,

                                            0,

                                            wszSSID,

                                            nSSIDLen,

                                            pWCP->wzcConfig.Ssid.Ssid,

                                            sizeof(pWCP->wzcConfig.Ssid.Ssid),

                                            NULL,NULL)) {

                        pWCP->wzcConfig.Ssid.SsidLength = nSSIDLen;

                    }

                }

 

 

AFTER:

 

            if (pWCP->wzcConfig.Ssid.SsidLength != 0) {

                // ugly but this is life. In order to convert the SSID to LPWSTR we need a buffer.

                // We know an SSID can't exceed 32 chars (see NDIS_802_11_SSID from ntddndis.h) so

                // make room for the null terminator and that's it. We could do mem alloc but I'm

                // not sure it worth the effort (at runtime).

                WCHAR   wszSSID[33];

                UINT    nLenSSID = 0;

 

                // convert the LPSTR (original SSID format) to LPWSTR (needed in List Ctrl)

                nLenSSID = MultiByteToWideChar(

                                              CP_ACP,

                                              0,

                                              (LPCSTR)pWCP->wzcConfig.Ssid.Ssid,

                                              pWCP->wzcConfig.Ssid.SsidLength,

                                              wszSSID,

                                              ARRAYSIZE(wszSSID));

              if (nLenSSID != 0)

                {

                    wszSSID[nLenSSID] = L'\0';

                    SetWindowText(pWCP->hwndEdSSID, wszSSID);

                }

            }

 

            // Check the "this network is adhoc" box if neccessary.

            SendMessage(pWCP->hwndChkAdhoc, BM_SETCHECK, (pWCP->wzcConfig.InfrastructureMode == Ndis802_11IBSS) ? BST_CHECKED : BST_UNCHECKED, 0);

 

            // Check the "Use the network key to access this network" checkbox if necessary

            // Checking this corresponds to "Shared" auth mode. Unchecked corresponds to "Open" (dsheldon)

            SendMessage(pWCP->hwndChkShared, BM_SETCHECK, pWCP->wzcConfig.AuthenticationMode ? BST_CHECKED : BST_UNCHECKED, 0);

 

            // the SSID can't be under any circumstances larger than 32 chars

            SendMessage(pWCP->hwndEdSSID, EM_LIMITTEXT, 32, 0);

 

            SendMessage(pWCP->hwndUsePW, BM_SETCHECK, (pWCP->wzcConfig.Privacy == 1) ? BST_CHECKED : BST_UNCHECKED, 0);

 

            // enable or disable the controls based on how the dialog is called

            EnableWindow(pWCP->hwndEdSSID, pWCP->dwFlags & WZCDLG_PROPS_RWSSID);

            EnableWindow(pWCP->hwndChkAdhoc, pWCP->dwFlags & WZCDLG_PROPS_RWINFR);

            EnableWindow(pWCP->hwndChkShared, pWCP->dwFlags & WZCDLG_PROPS_RWAUTH);

            EnableWindow(pWCP->hwndUsePW, pWCP->dwFlags & WZCDLG_PROPS_RWWEP);

           

            // check whether the "Wire Equivalent Privacy key" needs to be checked

            CheckDlgButton(hDlg,IDC_USEHARDWAREPW,

                           (pWCP->wzcConfig.dwCtlFlags & WZCCTL_WEPK_PRESENT) ? BST_UNCHECKED : BST_CHECKED);

 

            // Enable/disable WEP controls

            EnableWepKControls(hDlg, pWCP);

 

            // Enable/disable 802.1x controls

            if ((Init8021xControls(hDlg,pWCP) != ERROR_SUCCESS) || !(pWCP->dwFlags & WZCDLG_PROPS_RW8021X)) {

                EnableWindow(pWCP->hwndChkEnable8021x, FALSE);

                EnableWindow(pWCP->hwndCbEAPType, FALSE);

                EnableWindow(pWCP->hwndBtnEAPProps, FALSE);

            }

            else {

                Enable8021xControls(hDlg,pWCP);

            }

 

            // at this point we can say the WEP key is untouched

            pWCP->bKMatTouched = FALSE;

        }

        break;

 

    case WM_COMMAND :

       

        wCmdId  = LOWORD(wParam);

        wCmdCbn = HIWORD(wParam);

 

            pWCP = (WLAN_CFG_PROPS *) GetWindowLong (hDlg, GWL_USERDATA);

        if (pWCP == NULL)

            return FALSE;

 

        switch ( wCmdId ) {

       

        case IDCANCEL:

            Cleanup8021xControls(pWCP);

 

            EndDialog(hDlg,IDCANCEL);

            break;

 

        case IDOK:

            {

                UINT nSSIDLen, nSSIDLenA;

                // variables used for prompting the user with warning/err messages

                UINT  nWarnStringID = 0;

                WCHAR wszWarn1[48], wszWarn2[48];

 

                pWCP->wzcConfig.Length = sizeof(WZC_WLAN_CONFIG);

                pWCP->wzcConfig.InfrastructureMode = (BST_CHECKED == SendMessage(pWCP->hwndChkAdhoc, BM_GETCHECK, 0, 0)) ? Ndis802_11IBSS : Ndis802_11Infrastructure;

                pWCP->wzcConfig.AuthenticationMode = (BST_CHECKED == SendMessage(pWCP->hwndChkShared, BM_GETCHECK, 0, 0)) ? Ndis802_11AuthModeShared : Ndis802_11AuthModeOpen;

                pWCP->wzcConfig.Privacy = (BYTE) (BST_CHECKED == SendMessage(pWCP->hwndUsePW, BM_GETCHECK, 0, 0)) ? 1 : 0;

 

                // get the ssid (max 32 chars)

                {

                    WCHAR wszSSID[33];

                    nSSIDLen = GetWindowText(

                                             pWCP->hwndEdSSID,

                                             wszSSID,

                                             ARRAYSIZE(wszSSID));

 

                    // copy over whatever it is in the control to the ndis data structure

                    nSSIDLenA = WideCharToMultiByte(CP_ACP,

                                            0,

                                            wszSSID,

                                            nSSIDLen,

                                            pWCP->wzcConfig.Ssid.Ssid,

                                            sizeof(pWCP->wzcConfig.Ssid.Ssid),

                                            NULL,NULL);

                    if (nSSIDLenA)

                        pWCP->wzcConfig.Ssid.SsidLength = nSSIDLenA;

                }

 

 

 

FILE:  PUBLIC\COMMON\OAK\DRIVERS\NETUI\WZCUI.C

 

BEFORE:

 

DWORD

AddConfigToListView(PWLAN_CONFIG_LISTENT pConfig,HWND hwndLV, INT nPos)

{

    DWORD   dwErr = ERROR_SUCCESS;

    // SSID can't exceed 32 chars (see NDIS_802_11_SSID from ntddndis.h)

    WCHAR   wszSSID[sizeof(WCHAR)*33];

 

    // convert the LPSTR (original SSID format) to LPWSTR (needed in List Ctrl)

    if (pConfig->wzcConfig.Ssid.SsidLength != 0 &&

        MultiByteToWideChar(

            CP_ACP,

            0,

            (LPCSTR)pConfig->wzcConfig.Ssid.Ssid,

            pConfig->wzcConfig.Ssid.SsidLength,

            wszSSID,

            ARRAYSIZE(wszSSID)) == 0)

    {

        dwErr = GetLastError();

    }

    else

    {

        LVITEM                            lvi = {0};

        UINT                              nImgIdx,i;

            INT                                 j;

        INT                               iListSize;

            BOOL                          fMatch = FALSE;

            WCHAR                         wszListItem[MAX_SSID_LEN];

        CHAR                              szListItem[MAX_SSID_LEN];

 

       

        // put the null terminator

        wszSSID[pConfig->wzcConfig.Ssid.SsidLength]=L'\0';

        for (i=0;i<pConfig->wzcConfig.Ssid.SsidLength;i++) {

            if (wszSSID[i] != L' ')

                break;

        }

        if (i == pConfig->wzcConfig.Ssid.SsidLength) {

            // Blank SSID, fill in with special string

            LoadString(v_hInst,IDS_WZC_BLANK_SSID,wszSSID,ARRAYSIZE(wszSSID));

        }

 

        // get the item's image index

 

 

AFTER:

 

DWORD

AddConfigToListView(PWLAN_CONFIG_LISTENT pConfig,HWND hwndLV, INT nPos)

{

    DWORD   dwErr = ERROR_SUCCESS;

    // SSID can't exceed 32 chars (see NDIS_802_11_SSID from ntddndis.h)

    WCHAR   wszSSID[sizeof(WCHAR)*33];

    UINT    nLenSSID = 0;

 

    // convert the LPSTR (original SSID format) to LPWSTR (needed in List Ctrl)

    if (pConfig->wzcConfig.Ssid.SsidLength != 0)

    {

        nLenSSID = MultiByteToWideChar(

                                      CP_ACP,

                                      0,

                                      (LPCSTR)pConfig->wzcConfig.Ssid.Ssid,

                                      pConfig->wzcConfig.Ssid.SsidLength,

                                      wszSSID,

                                      ARRAYSIZE(wszSSID));

        if (nLenSSID == 0)

            dwErr = GetLastError();

    }

 

    if (dwErr == ERROR_SUCCESS)

    {

        LVITEM                            lvi = {0};

        UINT                              nImgIdx,i;

            INT                                 j;

        INT                               iListSize;

            BOOL                          fMatch = FALSE;

            WCHAR                         wszListItem[MAX_SSID_LEN];

        CHAR                              szListItem[MAX_SSID_LEN];

 

       

        // put the null terminator

        wszSSID[nLenSSID]=L'\0';

        for (i=0;i<nLenSSID;i++) {

            if (wszSSID[i] != L' ')

                break;

        }

        if (i == nLenSSID) {

            // Blank SSID, fill in with special string

            LoadString(v_hInst,IDS_WZC_BLANK_SSID,wszSSID,ARRAYSIZE(wszSSID));

        }

 

        // get the item's image index