summaryrefslogtreecommitdiff
path: root/network/wlan
diff options
context:
space:
mode:
Diffstat (limited to 'network/wlan')
-rw-r--r--network/wlan/WDI/COMMON/common.vcxproj6
-rw-r--r--network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj133
-rw-r--r--network/wlan/WDI/HEADER/PlatformDef.h32
-rw-r--r--network/wlan/WDI/PLATFORM/NDIS6/Ndis6Common.c408
-rw-r--r--network/wlan/ihvsampleui/IHVSampleUI.vcxproj114
5 files changed, 234 insertions, 459 deletions
diff --git a/network/wlan/WDI/COMMON/common.vcxproj b/network/wlan/WDI/COMMON/common.vcxproj
index e6f6a941..2842595d 100644
--- a/network/wlan/WDI/COMMON/common.vcxproj
+++ b/network/wlan/WDI/COMMON/common.vcxproj
@@ -21,7 +21,7 @@
<PropertyGroup Label="PropertySheets">
<ConversionToolVersion>1.0</ConversionToolVersion>
<BUILD_ALT_DIR>$(Configuration.Replace(' ',''))</BUILD_ALT_DIR>
- <IntDir Condition="'$(Platform)'!='Win32'">$(BUILD_ALT_DIR)\$(Platform)\</IntDir>
+ <IntDir>$(BUILD_ALT_DIR)\$(Platform)\</IntDir>
<OutDir>$(SolutionDir)COMMON\$(Configuration)\$(Platform)\</OutDir>
</PropertyGroup>
<ImportGroup Label="PreConfiguration">
@@ -30,10 +30,6 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{956B060D-1055-4584-9CF4-9FE14C428545}</ProjectGuid>
</PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">
- <TargetVersion>Win8</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>True</UseDebugLibraries>
diff --git a/network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj b/network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj
index 30586499..a4044511 100644
--- a/network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj
+++ b/network/wlan/WDI/HAL/HALSOURCE/hal.vcxproj
@@ -1,78 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Arm">
- <Configuration>Debug</Configuration>
- <Platform>Arm</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
- <ProjectConfiguration Include="Release|Arm">
- <Configuration>Release</Configuration>
- <Platform>Arm</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
- <ProjectConfiguration Include="WinBlue Debug|Arm">
- <Configuration>WinBlue Debug</Configuration>
- <Platform>Arm</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win8 Debug|Arm">
- <Configuration>Win8 Debug</Configuration>
- <Platform>Arm</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="WinBlue Release|Arm">
- <Configuration>WinBlue Release</Configuration>
- <Platform>Arm</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win8 Release|Arm">
- <Configuration>Win8 Release</Configuration>
- <Platform>Arm</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="WinBlue Debug|Win32">
- <Configuration>WinBlue Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win8 Debug|Win32">
- <Configuration>Win8 Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win7 Debug|Win32">
- <Configuration>Win7 Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Vista Debug|Win32">
- <Configuration>Vista Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="WinBlue Release|Win32">
- <Configuration>WinBlue Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win8 Release|Win32">
- <Configuration>Win8 Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win7 Release|Win32">
- <Configuration>Win7 Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Vista Release|Win32">
- <Configuration>Vista Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
<ProjectConfiguration Include="WinBlue Debug|x64">
<Configuration>WinBlue Debug</Configuration>
<Platform>x64</Platform>
@@ -118,8 +54,7 @@
<PropertyGroup Label="PropertySheets">
<ConversionToolVersion>1.0</ConversionToolVersion>
<BUILD_ALT_DIR>$(Configuration.Replace(' ',''))</BUILD_ALT_DIR>
- <IntDir Condition="'$(Platform)'!='Win32'">$(BUILD_ALT_DIR)\$(Platform)\</IntDir>
- <IntDir Condition="'$(Platform)'=='Win32'">$(BUILD_ALT_DIR)\x86\</IntDir>
+ <IntDir>$(BUILD_ALT_DIR)\$(Platform)\</IntDir>
<OutDir>$(IntDir)</OutDir>
</PropertyGroup>
<ImportGroup Label="PreConfiguration">
@@ -128,72 +63,6 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{316BB9D3-0947-4431-BC09-1C71C7201001}</ProjectGuid>
</PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='WinBlue Debug|Arm'">
- <TargetVersion>WindowsV6.3</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Arm'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Mobile</DriverTargetPlatform>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Arm'">
- <TargetVersion>Win8</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='WinBlue Release|Arm'">
- <TargetVersion>WindowsV6.3</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Arm'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Mobile</DriverTargetPlatform>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Arm'">
- <TargetVersion>Win8</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='WinBlue Debug|Win32'">
- <TargetVersion>WindowsV6.3</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'">
- <TargetVersion>Win8</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'">
- <TargetVersion>Win7</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Vista Debug|Win32'">
- <TargetVersion>Vista</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='WinBlue Release|Win32'">
- <TargetVersion>WindowsV6.3</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win8 Release|Win32'">
- <TargetVersion>Win8</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Win7 Release|Win32'">
- <TargetVersion>Win7</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Vista Release|Win32'">
- <TargetVersion>Vista</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- </PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='WinBlue Debug|x64'">
<TargetVersion>WindowsV6.3</TargetVersion>
<UseDebugLibraries>True</UseDebugLibraries>
diff --git a/network/wlan/WDI/HEADER/PlatformDef.h b/network/wlan/WDI/HEADER/PlatformDef.h
index cad6fb7a..a8f4fb55 100644
--- a/network/wlan/WDI/HEADER/PlatformDef.h
+++ b/network/wlan/WDI/HEADER/PlatformDef.h
@@ -813,42 +813,42 @@ PlatformRequestPreAuthentication(
RT_STATUS
PlatformReadFile(
- IN PVOID Adapter,
- IN ps1Byte szFileName,
- IN OUT pu1Byte pBufOfLines,
- IN s4Byte nMaxNumLine,
- IN s4Byte nMaxByteCntLine,
- OUT ps4Byte pnNumLines
+ IN PVOID Adapter,
+ IN UNICODE_STRING* fileName,
+ IN OUT pu1Byte pBufOfLines,
+ IN s4Byte nMaxNumLine,
+ IN s4Byte nMaxByteCntLine,
+ OUT ps4Byte pnNumLinesRead
);
RT_STATUS
PlatformOpenFile(
- IN PVOID Adapter,
- IN ps1Byte szFileName,
- IN OUT PRT_FILE_HANDLER pFileHandler
+ IN UNICODE_STRING* fileName,
+ IN OUT HANDLE* fileHandle
);
RT_STATUS
PlatformMapFile(
- IN OUT PRT_FILE_HANDLER pFileHandler
+ IN OUT HANDLE* fileHandle,
+ OUT u1Byte* contentBuffer,
+ OUT s4Byte* contentBufferLength
);
VOID
PlatformUnMapFile(
- IN OUT PRT_FILE_HANDLER pFileHandler
+ IN OUT u1Byte* contentBuffer
);
VOID
PlatformCloseFile(
- IN OUT PRT_FILE_HANDLER pFileHandler
+ IN OUT HANDLE* fileHandle
);
RT_STATUS
PlatformReadAndMapFile(
- IN PVOID Adapter,
- IN ps1Byte szFileName,
- IN OUT pu1Byte pOutFile,
- IN OUT pu4Byte UNALIGNED pFileSize
+ IN UNICODE_STRING* fileName,
+ OUT u1Byte* outFileBuffer,
+ OUT u4Byte* outFileBufferLength
);
BOOLEAN
diff --git a/network/wlan/WDI/PLATFORM/NDIS6/Ndis6Common.c b/network/wlan/WDI/PLATFORM/NDIS6/Ndis6Common.c
index d122f0c0..a8eb835d 100644
--- a/network/wlan/WDI/PLATFORM/NDIS6/Ndis6Common.c
+++ b/network/wlan/WDI/PLATFORM/NDIS6/Ndis6Common.c
@@ -207,85 +207,105 @@ ParseFileBufToLines(
// which is a 2-dimention array, for example,
// u1Byte pBufOfLines[nMaxNumLine][nMaxByteCntLine].
//
-// Note:
-// In NDIS5, the file to open shall be placed at the directory the same as
-// driver binary.
-//
RT_STATUS
PlatformReadFile(
- IN PVOID Adapter,
- IN ps1Byte szFileName,
- IN OUT pu1Byte pBufOfLines,
- IN s4Byte nMaxNumLine,
- IN s4Byte nMaxByteCntLine,
- OUT ps4Byte pnNumLinesRead
+ IN PVOID Adapter,
+ IN UNICODE_STRING* fileName,
+ IN OUT pu1Byte pBufOfLines,
+ IN s4Byte nMaxNumLine,
+ IN s4Byte nMaxByteCntLine,
+ OUT ps4Byte pnNumLinesRead
)
{
- RT_STATUS rtStatus = RT_STATUS_FAILURE;
- NDIS_STRING NdisStrFileName;
- NDIS_PHYSICAL_ADDRESS ndisPhyAddr;
- NDIS_STATUS ndisStatus;
- NDIS_HANDLE hFileHandle;
- UINT ulFileLength;
- pu1Byte pMappedFile = NULL;
+ RT_STATUS rtStatus = RT_STATUS_FAILURE;
+ OBJECT_ATTRIBUTES objectAttributes;
+ HANDLE fileHandle;
+ IO_STATUS_BLOCK iostatBlock;
+ NTSTATUS ntStatus;
- // Check input parameters.
- if(szFileName == NULL)
- {
- RT_TRACE(COMP_INIT, DBG_WARNING, ("PlatformReadFile(): szFileName should not be NULL!\n"));
- return rtStatus;
- }
+ // Check Input parameters.
if(pBufOfLines == NULL)
{
RT_TRACE(COMP_INIT, DBG_WARNING, ("PlatformReadFile(): pBufOfLines should not be NULL!\n"));
return rtStatus;
}
- // Convert szFileName to NDIS_STRING.
- NdisInitializeString(&NdisStrFileName, (PUCHAR)szFileName);
- if(NdisStrFileName.Buffer != NULL && NdisStrFileName.Length > 0)
- {
- // Open the file specified.
- ndisPhyAddr.LowPart = ndisPhyAddr.HighPart = -1;
- NdisOpenFile(&ndisStatus,
- &hFileHandle,
- &ulFileLength,
- &NdisStrFileName,
- ndisPhyAddr);
- if(ndisStatus == NDIS_STATUS_SUCCESS)
- {
- // Map the file into memory.
- NdisMapFile(&ndisStatus, (PVOID *)(&pMappedFile), hFileHandle);
- if(ndisStatus == NDIS_STATUS_SUCCESS)
- {
- // Read the file into pBufOfLines.
- ParseFileBufToLines(Adapter, pMappedFile, ulFileLength, pBufOfLines, nMaxNumLine, nMaxByteCntLine, pnNumLinesRead);
-
- // Return Success only when Config Success
- rtStatus = RT_STATUS_SUCCESS;
-
- // Relase the memory for mapping the file.
- NdisUnmapFile(hFileHandle);
+ // Initialize the object attributes of the file we want to open
+ InitializeObjectAttributes(
+ &objectAttributes,
+ fileName,
+ OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
+ NULL, // RootDirectory
+ NULL // Default Security
+ );
+
+ // Open the file using the object attributes to get a Handle
+ ntStatus = ZwOpenFile(
+ &fileHandle,
+ GENERIC_READ,
+ &objectAttributes,
+ &iostatBlock,
+ 0, // Do not share the file
+ FILE_NON_DIRECTORY_FILE
+ );
+
+ if (NT_SUCCESS(ntStatus)) {
+ FILE_STANDARD_INFORMATION fileInformation = { 0 };
+
+ // Get the file information to know the size we need to alloc
+ ntStatus = ZwQueryInformationFile(
+ fileHandle,
+ &iostatBlock,
+ &fileInformation,
+ sizeof(fileInformation),
+ FileStandardInformation
+ );
+
+ if (NT_SUCCESS(ntStatus)) {
+ u1Byte* buffer = NULL;
+ s4Byte bufferLength = (s4Byte)fileInformation.EndOfFile.QuadPart;
+
+ // Try to allocate space to read the file
+ buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, bufferLength, 'frP');
+ if (buffer) {
+
+ // If alloc was successful, then read the file
+ ntStatus = ZwReadFile(
+ fileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &iostatBlock,
+ buffer,
+ bufferLength,
+ 0, // No offset
+ NULL
+ );
+
+ if (NT_SUCCESS(ntStatus)) {
+ // Read the buffer into pBufOfLines.
+ ParseFileBufToLines(Adapter, buffer, bufferLength, pBufOfLines, nMaxNumLine, nMaxByteCntLine, pnNumLinesRead);
+ rtStatus = RT_STATUS_SUCCESS;
+ }
+ else {
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to read file, ntStatus: %#X\n", ntStatus));
+ }
+
+ ExFreePool(buffer);
+
}
- else
- {
- RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to map the file, %s!, ndisStatus: %#X\n", szFileName, ndisStatus));
+ else {
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to allocate space for file!\n"));
}
-
- // Close the file.
- NdisCloseFile(hFileHandle);
}
- else
- {
- RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to open the file, %s!, ndisStatus: %#X\n", szFileName, ndisStatus));
+ else {
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to read file attributes!, ntStatus: %#X\n", ntStatus));
}
-
- // Release the NDIS_STRING allocated via NdisInitializeString().
- NdisFreeString(NdisStrFileName);
+
+ ZwClose(fileHandle);
}
- else
- {
- RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): NdisInitializeString() failed! szFileName: %s\n", szFileName));
+ else {
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to open the file!, ntStatus: %#X\n", ntStatus));
}
return rtStatus;
@@ -293,51 +313,39 @@ PlatformReadFile(
RT_STATUS
PlatformOpenFile(
- IN PVOID Adapter,
- IN ps1Byte szFileName,
- IN OUT PRT_FILE_HANDLER pFileHandler
+ IN UNICODE_STRING* fileName,
+ IN OUT HANDLE* fileHandle
)
{
- RT_STATUS rtStatus = RT_STATUS_FAILURE;
- NDIS_STRING NdisStrFileName;
- NDIS_PHYSICAL_ADDRESS ndisPhyAddr;
- NDIS_STATUS ndisStatus;
- pu1Byte pMappedFile = NULL;
+ RT_STATUS rtStatus = RT_STATUS_FAILURE;
+ OBJECT_ATTRIBUTES objectAttributes;
+ IO_STATUS_BLOCK iostatBlock;
+ NTSTATUS ntStatus;
-
- // Check input parameters.
- if(szFileName == NULL)
- {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("PlatformOpenFile(): szFileName should not be NULL!\n"));
- return rtStatus;
- }
+ // Initialize the object attributes of the file we want to open
+ InitializeObjectAttributes(
+ &objectAttributes,
+ fileName,
+ OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
+ NULL, // RootDirectory
+ NULL // Default Security
+ );
- // Convert szFileName to NDIS_STRING.
- NdisInitializeString(&NdisStrFileName, (PUCHAR)szFileName);
- if(NdisStrFileName.Buffer != NULL && NdisStrFileName.Length > 0)
- {
- // Open the file specified.
- ndisPhyAddr.LowPart = ndisPhyAddr.HighPart = -1;
- NdisOpenFile(&ndisStatus,
- &(pFileHandler->FileHandler),
- &(pFileHandler->FileLength),
- &NdisStrFileName,
- ndisPhyAddr);
-
- NdisFreeString(NdisStrFileName);
- if(ndisStatus == NDIS_STATUS_SUCCESS)
- {
- rtStatus = RT_STATUS_SUCCESS;
- }
- else
- {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("PlatformOpenFile(): failed to open the file, %s!, ndisStatus: %#X\n", szFileName, ndisStatus));
- }
-
+ // Open the file using the object attributes to get a Handle
+ ntStatus = ZwOpenFile(
+ fileHandle,
+ GENERIC_READ,
+ &objectAttributes,
+ &iostatBlock,
+ 0, // Do not share the file
+ FILE_NON_DIRECTORY_FILE
+ );
+
+ if (NT_SUCCESS(ntStatus)) {
+ rtStatus = RT_STATUS_SUCCESS;
}
- else
- {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("PlatformOpenFile(): NdisInitializeString() failed! szFileName: %s\n", szFileName));
+ else {
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to open the file!, ntStatus: %#X, fileName: %wZ\n", ntStatus, fileName));
}
return rtStatus;
@@ -345,20 +353,66 @@ PlatformOpenFile(
RT_STATUS
PlatformMapFile(
- IN OUT PRT_FILE_HANDLER pFileHandler
+ IN OUT HANDLE* fileHandle,
+ OUT u1Byte* contentBuffer,
+ OUT s4Byte* contentBufferLength
)
{
- RT_STATUS rtStatus = RT_STATUS_FAILURE;
- NDIS_STATUS ndisStatus;
-
- // Map the file into memory.
- NdisMapFile(&ndisStatus, (PVOID *)(&(pFileHandler->MappedFile)), pFileHandler->FileHandler);
- if(ndisStatus == NDIS_STATUS_SUCCESS) {
- rtStatus = RT_STATUS_SUCCESS;
+ RT_STATUS rtStatus = RT_STATUS_FAILURE;
+ OBJECT_ATTRIBUTES objectAttributes;
+ IO_STATUS_BLOCK iostatBlock;
+ NTSTATUS ntStatus;
+
+
+ FILE_STANDARD_INFORMATION fileInformation = { 0 };
+
+ // Get the file information to know the size we need to alloc
+ ntStatus = ZwQueryInformationFile(
+ *fileHandle,
+ &iostatBlock,
+ &fileInformation,
+ sizeof(fileInformation),
+ FileStandardInformation
+ );
+
+ if (NT_SUCCESS(ntStatus)) {
+ u1Byte* buffer = NULL;
+ s4Byte bufferLength = (s4Byte)fileInformation.EndOfFile.QuadPart;
+
+ // Try to allocate space to read the file
+ buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, bufferLength, 'frP');
+ if (buffer) {
+
+ // If alloc was successful, then read the file
+ ntStatus = ZwReadFile(
+ fileHandle,
+ NULL,
+ NULL,
+ NULL,
+ &iostatBlock,
+ buffer,
+ bufferLength,
+ 0, // No offset
+ NULL
+ );
+
+ if (NT_SUCCESS(ntStatus)) {
+ contentBuffer = buffer;
+ *contentBufferLength = bufferLength;
+ rtStatus = RT_STATUS_SUCCESS;
+ }
+ else {
+ ExFreePool(buffer);
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to read file, ntStatus: %#X\n", ntStatus));
+ }
+ }
+ else {
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to allocate space for file!\n"));
+ }
}
else {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("PlatformMapFile(): failed to map the file!, ndisStatus: %#X\n", ndisStatus));
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadFile(): failed to read file attributes!, ntStatus: %#X\n", ntStatus));
}
return rtStatus;
@@ -366,22 +420,65 @@ PlatformMapFile(
VOID
PlatformUnMapFile(
- IN OUT PRT_FILE_HANDLER pFileHandler
+ IN OUT u1Byte* contentBuffer
)
{
// Relase the memory for mapping the file.
- NdisUnmapFile(pFileHandler->FileHandler);
+ ExFreePool(contentBuffer);
}
+
VOID
PlatformCloseFile(
- IN OUT PRT_FILE_HANDLER pFileHandler
+ IN OUT HANDLE* fileHandle
)
{
// Relase the memory for mapping the file.
- NdisCloseFile(pFileHandler->FileHandler);
+ ZwClose(fileHandle);
+}
+
+//
+// Description:
+// Open the file specifed and copy the file into an byte buffer,
+//
+RT_STATUS
+PlatformReadAndMapFile(
+ IN UNICODE_STRING* fileName,
+ OUT u1Byte* outFileBuffer,
+ OUT u4Byte* outFileBufferLength
+)
+{
+ RT_STATUS rtStatus = RT_STATUS_FAILURE;
+ HANDLE fileHandle;
+ RT_STATUS callStatus;
+
+ callStatus = PlatformOpenFile(fileName, &fileHandle);
+
+ if (callStatus == RT_STATUS_SUCCESS) {
+ u1Byte* fileBuffer = NULL;
+ u4Byte* fileBufferLength = NULL;
+
+ callStatus = PlatformMapFile(&fileHandle, fileBuffer, fileBufferLength);
+
+ if (callStatus == RT_STATUS_SUCCESS) {
+ outFileBuffer = fileBuffer;
+ outFileBufferLength = fileBufferLength;
+ rtStatus = RT_STATUS_SUCCESS;
+ }
+ else {
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadAndMapFile(): failed to map file!, rtStatus: %#X\n", callStatus));
+ }
+
+ PlatformCloseFile(fileHandle);
+ }
+ else {
+ RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadAndMapFile(): failed to open the file!, rtStatus: %#X\n", callStatus));
+ }
+
+ return rtStatus;
}
+
//
// Description:
// Indication for PHY power state changed.
@@ -2722,85 +2819,6 @@ N6InitializeNative80211MIBs(
Adapter->pNdisCommon->PrivacyExemptionEntrieNum = 0;
}
-//
-// Description:
-// Open the file specifed and copy the file into an array,
-//
-RT_STATUS
-PlatformReadAndMapFile(
- IN PVOID Adapter,
- IN ps1Byte szFileName,
- IN OUT pu1Byte pOutFile,
- IN OUT pu4Byte UNALIGNED pFileSize
- )
-{
- RT_STATUS rtStatus = RT_STATUS_FAILURE;
- NDIS_STRING NdisStrFileName;
- NDIS_PHYSICAL_ADDRESS ndisPhyAddr;
- NDIS_STATUS ndisStatus;
- NDIS_HANDLE hFileHandle;
- UINT ulFileLength;
- pu1Byte pMappedFile = NULL;
-
- // Check input parameters.
- if(szFileName == NULL)
- {
- RT_TRACE(COMP_INIT, DBG_WARNING, ("PlatformReadAndMapFile(): szFileName should not be NULL!\n"));
- return rtStatus;
- }
-
-
- // Convert szFileName to NDIS_STRING.
- NdisInitializeString(&NdisStrFileName, (PUCHAR)szFileName);
- if(NdisStrFileName.Buffer != NULL && NdisStrFileName.Length > 0)
- {
- // Open the file specified.
- ndisPhyAddr.LowPart = ndisPhyAddr.HighPart = -1;
- NdisOpenFile(&ndisStatus,
- &hFileHandle,
- &ulFileLength,
- &NdisStrFileName,
- ndisPhyAddr);
- if(ndisStatus == NDIS_STATUS_SUCCESS)
- {
- // Map the file into memory.
- NdisMapFile(&ndisStatus, (PVOID *)(&pMappedFile), hFileHandle);
- if(ndisStatus == NDIS_STATUS_SUCCESS)
- {
- // Copy File into array
- PlatformMoveMemory(pOutFile, pMappedFile, ulFileLength);
- *pFileSize = ulFileLength;
-
- // Return Success only when Config Success
- rtStatus = RT_STATUS_SUCCESS;
-
- // Relase the memory for mapping the file.
- NdisUnmapFile(hFileHandle);
- }
- else
- {
- RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadAndMapFile(): failed to map the file, %s!, ndisStatus: %#X\n", szFileName, ndisStatus));
- }
-
- // Close the file.
- NdisCloseFile(hFileHandle);
- }
- else
- {
- RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadAndMapFile(): failed to open the file, %s!, ndisStatus: %#X\n", szFileName, ndisStatus));
- }
-
- // Release the NDIS_STRING allocated via NdisInitializeString().
- NdisFreeString(NdisStrFileName);
- }
- else
- {
- RT_TRACE(COMP_INIT, DBG_SERIOUS, ("PlatformReadAndMapFile(): NdisInitializeString() failed! szFileName: %s\n", szFileName));
- }
-
- return rtStatus;
-}
-
//
// Description:
diff --git a/network/wlan/ihvsampleui/IHVSampleUI.vcxproj b/network/wlan/ihvsampleui/IHVSampleUI.vcxproj
index 36ff1126..09f3dad7 100644
--- a/network/wlan/ihvsampleui/IHVSampleUI.vcxproj
+++ b/network/wlan/ihvsampleui/IHVSampleUI.vcxproj
@@ -1,14 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
@@ -22,7 +14,7 @@
<ProjectGuid>{1EE6DF41-8C0B-4C74-98D2-FCDF020E7128}</ProjectGuid>
<RootNamespace>$(MSBuildProjectName)</RootNamespace>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
+ <Platform Condition="'$(Platform)' == ''">x64</Platform>
<SampleGuid>{C7745B6F-E931-4E1C-A12B-5BF1C854C635}</SampleGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@@ -42,22 +34,6 @@
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType />
- <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<OutDir>$(IntDir)</OutDir>
@@ -68,12 +44,6 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
<ItemGroup Label="WrappedTaskItems" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>IHVSampleUI</TargetName>
@@ -81,12 +51,6 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>IHVSampleUI</TargetName>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>IHVSampleUI</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>IHVSampleUI</TargetName>
- </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
@@ -98,8 +62,7 @@
<PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
</ResourceCompile>
<Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ <EntryPointSymbol>_DllMainCRTStartup</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -113,38 +76,7 @@
<PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
</ResourceCompile>
<Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;WIN32</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
+ <EntryPointSymbol>_DllMainCRTStartup</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -187,46 +119,6 @@
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
</Midl>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalOptions>%(AdditionalOptions) /EHa</AdditionalOptions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);ole32.lib;oleaut32.lib;user32.lib;uuid.lib;Kernel32.lib;Advapi32.lib;comctl32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>IHVSampleUI.def</ModuleDefinitionFile>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalOptions>%(AdditionalOptions) /EHa</AdditionalOptions>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);ole32.lib;oleaut32.lib;user32.lib;uuid.lib;Kernel32.lib;Advapi32.lib;comctl32.lib</AdditionalDependencies>
- <ModuleDefinitionFile>IHVSampleUI.def</ModuleDefinitionFile>
- </Link>
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- </ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="IHVClassFactory.cpp" />
<ClCompile Include="IHVRegistryHelper.cpp" />