https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6623b8d15527551e044da01d719209ed6effa552

commit 6623b8d15527551e044da01d719209ed6effa552
Author:     Eric Kohl <[email protected]>
AuthorDate: Fri Dec 31 16:35:25 2021 +0100
Commit:     Eric Kohl <[email protected]>
CommitDate: Fri Dec 31 16:35:25 2021 +0100

    [ARP] Move the message file
    
    Move the message file because we do not need to generate a global message 
header file for the arp utility.
---
 base/applications/network/arp/CMakeLists.txt       |  1 +
 base/applications/network/arp/arp.c                | 38 ++++++++++++----------
 .../applications/network/arp}/arp_msg.mc           |  0
 sdk/include/reactos/mc/CMakeLists.txt              |  1 -
 4 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/base/applications/network/arp/CMakeLists.txt 
b/base/applications/network/arp/CMakeLists.txt
index 6aba57385c9..9071093013b 100644
--- a/base/applications/network/arp/CMakeLists.txt
+++ b/base/applications/network/arp/CMakeLists.txt
@@ -1,4 +1,5 @@
 
+add_message_headers(UNICODE arp_msg.mc)
 add_executable(arp arp.c arp.rc)
 set_module_type(arp win32cui)
 add_dependencies(arp arp_msg)
diff --git a/base/applications/network/arp/arp.c 
b/base/applications/network/arp/arp.c
index f3e758a0095..467f2560122 100644
--- a/base/applications/network/arp/arp.c
+++ b/base/applications/network/arp/arp.c
@@ -39,6 +39,8 @@
 #include <winsock2.h>
 #include <iphlpapi.h>
 
+#include <arp_msg.h>
+
 /*
  * Globals
  */
@@ -168,19 +170,19 @@ DWORD PrintEntries(PMIB_IPNETROW pIpAddRow)
     switch (pIpAddRow->dwType)
     {
         case MIB_IPNET_TYPE_DYNAMIC:
-            PrintMessage(10007);
+            PrintMessage(MSG_ARP_DYNAMIC);
             break;
 
         case MIB_IPNET_TYPE_STATIC:
-            PrintMessage(10008);
+            PrintMessage(MSG_ARP_STATIC);
             break;
 
         case MIB_IPNET_TYPE_INVALID:
-            PrintMessage(10006);
+            PrintMessage(MSG_ARP_INVALID);
             break;
 
         case MIB_IPNET_TYPE_OTHER:
-            PrintMessage(10005);
+            PrintMessage(MSG_ARP_OTHER);
             break;
     }
     _putts(_T(""));
@@ -217,7 +219,7 @@ DWORD DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR 
pszIfAddr)
     pIpNetTable = (PMIB_IPNETTABLE)HeapAlloc(GetProcessHeap(), 0, Size);
     if (pIpNetTable == NULL)
     {
-        PrintMessage(10004);
+        PrintMessage(MSG_ARP_NO_MEMORY);
         dwError = ERROR_NOT_ENOUGH_MEMORY;
         goto cleanup;
     }
@@ -235,7 +237,7 @@ DWORD DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR 
pszIfAddr)
     /* check there are entries in the table */
     if (pIpNetTable->dwNumEntries == 0)
     {
-        PrintMessage(10018);
+        PrintMessage(MSG_ARP_NO_ENTRIES);
         goto cleanup;
     }
 
@@ -249,7 +251,7 @@ DWORD DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR 
pszIfAddr)
     pIpAddrTable = (PMIB_IPADDRTABLE)HeapAlloc(GetProcessHeap(), 0, Size);
     if (pIpAddrTable == NULL)
     {
-        PrintMessage(10004);
+        PrintMessage(MSG_ARP_NO_MEMORY);
         dwError = ERROR_NOT_ENOUGH_MEMORY;
         goto cleanup;
     }
@@ -300,12 +302,12 @@ DWORD DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR 
pszIfAddr)
     /* Print message and leave if there are no relevant ARP entries */
     if (dwCount == 0)
     {
-        PrintMessage(10018);
+        PrintMessage(MSG_ARP_NO_ENTRIES);
         goto cleanup;
     }
 
     /* print header, including interface IP address and index number */
-    PrintMessageV(10003, szIntIpAddr, pIpNetTable->table[0].dwIndex);
+    PrintMessageV(MSG_ARP_INTERFACE, szIntIpAddr, 
pIpNetTable->table[0].dwIndex);
 
     /* go through all ARP entries */
     for (i = 0; i < pIpNetTable->dwNumEntries; i++)
@@ -365,14 +367,14 @@ DWORD Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, 
PTCHAR pszIfAddr)
     dwIpAddr = inet_addr(pszInetAddr);
     if (dwIpAddr == INADDR_NONE)
     {
-        PrintMessageV(10001, pszInetAddr);
+        PrintMessageV(MSG_ARP_BAD_IP_ADDRESS, pszInetAddr);
         return ERROR_INVALID_PARAMETER;
     }
 
     /* check MAC address */
     if (strlen(pszEthAddr) != 17)
     {
-        PrintMessageV(10002, pszEthAddr);
+        PrintMessageV(MSG_ARP_BAD_ARGUMENT, pszEthAddr);
         return ERROR_INVALID_PARAMETER;
     }
 
@@ -383,7 +385,7 @@ DWORD Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR 
pszIfAddr)
 
         if (!isxdigit(pszEthAddr[i]))
         {
-            PrintMessageV(10002, pszEthAddr);
+            PrintMessageV(MSG_ARP_BAD_ARGUMENT, pszEthAddr);
             return ERROR_INVALID_PARAMETER;
         }
     }
@@ -396,7 +398,7 @@ DWORD Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR 
pszIfAddr)
     pIpNetTable = (PMIB_IPNETTABLE)HeapAlloc(GetProcessHeap(), 0, Size);
     if (pIpNetTable == NULL)
     {
-        PrintMessage(10004);
+        PrintMessage(MSG_ARP_NO_MEMORY);
         dwError = ERROR_NOT_ENOUGH_MEMORY;
         goto cleanup;
     }
@@ -415,7 +417,7 @@ DWORD Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR 
pszIfAddr)
     pAddHost = (PMIB_IPNETROW)HeapAlloc(GetProcessHeap(), 0, 
sizeof(MIB_IPNETROW));
     if (pAddHost == NULL)
     {
-        PrintMessage(10004);
+        PrintMessage(MSG_ARP_NO_MEMORY);
         dwError = ERROR_NOT_ENOUGH_MEMORY;
         goto cleanup;
     }
@@ -518,7 +520,7 @@ DWORD Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
         dwIpAddr = inet_addr(pszInetAddr);
         if (dwIpAddr == INADDR_NONE)
         {
-            PrintMessageV(10001, pszInetAddr);
+            PrintMessageV(MSG_ARP_BAD_IP_ADDRESS, pszInetAddr);
             return ERROR_INVALID_PARAMETER;
         }
     }
@@ -531,7 +533,7 @@ DWORD Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
     pIpNetTable = (PMIB_IPNETTABLE) HeapAlloc(GetProcessHeap(), 0, Size);
     if (pIpNetTable == NULL)
     {
-        PrintMessage(10004);
+        PrintMessage(MSG_ARP_NO_MEMORY);
         dwError = ERROR_NOT_ENOUGH_MEMORY;
         goto cleanup;
     }
@@ -550,7 +552,7 @@ DWORD Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
     pDelHost = (MIB_IPNETROW *)HeapAlloc(GetProcessHeap(), 0, 
sizeof(MIB_IPNETROW));
     if (pDelHost == NULL)
     {
-        PrintMessage(10004);
+        PrintMessage(MSG_ARP_NO_MEMORY);
         dwError = ERROR_NOT_ENOUGH_MEMORY;
         goto cleanup;
     }
@@ -613,7 +615,7 @@ cleanup:
  */
 VOID Usage(VOID)
 {
-    PrintMessage(10000);
+    PrintMessage(MSG_ARP_SYNTAX);
 }
 
 /*
diff --git a/sdk/include/reactos/mc/arp_msg.mc 
b/base/applications/network/arp/arp_msg.mc
similarity index 100%
rename from sdk/include/reactos/mc/arp_msg.mc
rename to base/applications/network/arp/arp_msg.mc
diff --git a/sdk/include/reactos/mc/CMakeLists.txt 
b/sdk/include/reactos/mc/CMakeLists.txt
index 9899bb8a800..46753f3bc16 100644
--- a/sdk/include/reactos/mc/CMakeLists.txt
+++ b/sdk/include/reactos/mc/CMakeLists.txt
@@ -3,7 +3,6 @@ list(APPEND ANSI_SOURCE
      bugcodes.mc)
 
 list(APPEND UNICODE_SOURCE
-     arp_msg.mc
      errcodes.mc
      net_msg.mc
      neteventmsg.mc

Reply via email to