]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/SnpNt32Dxe/SnpNt32.c
We enabled X64 native version NT32, and made it works on Windows 7 X64 OS.
[mirror_edk2.git] / Nt32Pkg / SnpNt32Dxe / SnpNt32.c
index be9eb78fb5c0066b71691dc241a3b23b63591218..4dee182ad839db051532ea6d4c27d1c7a65fcff0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -440,7 +440,7 @@ SNPNT32_INSTANCE_DATA gSnpNt32InstanceTemplate = {
     NET_IFTYPE_ETHERNET,                  //  IfType\r
     FALSE,                                //  MacAddressChangeable\r
     FALSE,                                //  MultipleTxSupported\r
-    FALSE,                                //  MediaPresentSupported\r
+    TRUE,                                 //  MediaPresentSupported\r
     TRUE                                  //  MediaPresent\r
   },\r
   {\r
@@ -704,7 +704,7 @@ SnpNt32ReceiveFilters (
   ReturnValue = GlobalData->NtNetUtilityTable.SetReceiveFilter (\r
                                                 Instance->InterfaceInfo.InterfaceIndex,\r
                                                 EnableBits,\r
-                                                McastFilterCount,\r
+                                                (UINT32)McastFilterCount,\r
                                                 McastFilter\r
                                                 );\r
 \r
@@ -863,7 +863,7 @@ SnpNt32GetStatus (
 {\r
 \r
   if (TxBuffer != NULL) {\r
-    *((UINT8 **) TxBuffer) = (UINT8 *) 1;\r
+    *((UINT8 **) TxBuffer) = (UINT8 *)(UINTN) 1;\r
   }\r
 \r
   if (InterruptStatus != NULL) {\r
@@ -933,8 +933,8 @@ SnpNt32Transmit (
 \r
   ReturnValue = GlobalData->NtNetUtilityTable.Transmit (\r
                                                 Instance->InterfaceInfo.InterfaceIndex,\r
-                                                HeaderSize,\r
-                                                BufferSize,\r
+                                                (UINT32)HeaderSize,\r
+                                                (UINT32)BufferSize,\r
                                                 Buffer,\r
                                                 SrcAddr,\r
                                                 DestAddr,\r
@@ -995,6 +995,9 @@ SnpNt32Receive (
   SNPNT32_INSTANCE_DATA *Instance;\r
   SNPNT32_GLOBAL_DATA   *GlobalData;\r
   INT32                 ReturnValue;\r
+  UINTN                 BufSize;\r
+  \r
+  BufSize     = *BuffSize;\r
 \r
   Instance    = SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS (This);\r
 \r
@@ -1042,7 +1045,7 @@ SnpNt32Receive (
     *Protocol = NTOHS (*((UINT16 *) (((UINT8 *) Buffer) + 12)));\r
   }\r
 \r
-  return EFI_SUCCESS;\r
+  return (*BuffSize <= BufSize) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL; \r
 }\r
 \r
 /**\r
@@ -1186,7 +1189,7 @@ SnpNt32InitializeGlobalData (
     //\r
     //  Set the interface information.\r
     //\r
-    Instance->InterfaceInfo = NetInterfaceInfoBuffer[Index];\r
+    CopyMem (&Instance->InterfaceInfo, &NetInterfaceInfoBuffer[Index], sizeof(Instance->InterfaceInfo));\r
     //\r
     //  Initialize this instance\r
     //\r
@@ -1262,8 +1265,8 @@ SnpNt32InitializeInstanceData (
   //\r
   //  Copy Current/PermanentAddress MAC address\r
   //\r
-  Instance->Mode.CurrentAddress   = Instance->InterfaceInfo.MacAddr;\r
-  Instance->Mode.PermanentAddress = Instance->InterfaceInfo.MacAddr;\r
+  CopyMem (&Instance->Mode.CurrentAddress, &Instance->InterfaceInfo.MacAddr, sizeof(Instance->Mode.CurrentAddress));\r
+  CopyMem (&Instance->Mode.PermanentAddress, &Instance->InterfaceInfo.MacAddr, sizeof(Instance->Mode.PermanentAddress));\r
 \r
   //\r
   //  Since the fake SNP is based on a real NIC, to avoid conflict with the host\r