Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. Routing\Netsh\wins\winshndl.c
  5. Abstract:
  6. WINS Server Command dispatcher.
  7. Created by:
  8. Shubho Bhattacharya(a-sbhatt) on 12/14/98
  9. --*/
  10. #include "precomp.h"
  11. extern ULONG g_ulNumTopCmds;
  12. extern ULONG g_ulNumSubContext;
  13. extern WINSMON_SUBCONTEXT_TABLE_ENTRY g_WinsSubContextTable[];
  14. extern CMD_ENTRY g_WinsCmds[];
  15. DWORD
  16. HandleWinsDump(
  17. IN LPCWSTR pwszMachine,
  18. IN OUT LPWSTR *ppwcArguments,
  19. IN DWORD dwCurrentIndex,
  20. IN DWORD dwArgCount,
  21. IN DWORD dwFlags,
  22. IN LPCVOID pvData,
  23. OUT BOOL *pbDone
  24. )
  25. {
  26. DWORD Status = NO_ERROR;
  27. if( dwArgCount > dwCurrentIndex )
  28. {
  29. if( IsHelpToken(ppwcArguments[dwCurrentIndex]) is TRUE )
  30. {
  31. DisplayMessage(g_hModule,
  32. HLP_WINS_DUMP_EX);
  33. }
  34. }
  35. Status = WinsDump(NULL, ppwcArguments, dwArgCount, pvData);
  36. if( Status is NO_ERROR )
  37. DisplayMessage(g_hModule,
  38. EMSG_WINS_ERROR_SUCCESS);
  39. else if( Status is ERROR_FILE_NOT_FOUND )
  40. DisplayMessage(g_hModule,
  41. EMSG_WINS_NOT_CONFIGURED);
  42. else
  43. DisplayErrorMessage(EMSG_WINS_DUMP,
  44. Status);
  45. return Status;
  46. }
  47. DWORD
  48. HandleWinsHelp(
  49. IN LPCWSTR pwszMachine,
  50. IN OUT LPWSTR *ppwcArguments,
  51. IN DWORD dwCurrentIndex,
  52. IN DWORD dwArgCount,
  53. IN DWORD dwFlags,
  54. IN LPCVOID pvData,
  55. OUT BOOL *pbDone
  56. )
  57. {
  58. DWORD i, j;
  59. for(i = 0; i < g_ulNumTopCmds -2; i++)
  60. {
  61. if ((g_WinsCmds[i].dwCmdHlpToken == WINS_MSG_NULL)
  62. || !g_WinsCmds[i].pwszCmdToken[0] )
  63. {
  64. continue;
  65. }
  66. DisplayMessage(g_hModule,
  67. g_WinsCmds[i].dwShortCmdHelpToken);
  68. }
  69. for(i=0; i < g_ulNumSubContext; i++)
  70. {
  71. DisplayMessage(g_hModule, g_WinsSubContextTable[i].dwShortCmdHlpToken);
  72. DisplayMessage(g_hModule, WINS_FORMAT_LINE);
  73. }
  74. DisplayMessage(g_hModule, WINS_FORMAT_LINE);
  75. return NO_ERROR;
  76. }
  77. DWORD
  78. HandleWinsAddServer(
  79. IN LPCWSTR pwszMachine,
  80. IN OUT LPWSTR *ppwcArguments,
  81. IN DWORD dwCurrentIndex,
  82. IN DWORD dwArgCount,
  83. IN DWORD dwFlags,
  84. IN LPCVOID pvData,
  85. OUT BOOL *pbDone
  86. )
  87. {
  88. DWORD dwError = NO_ERROR;
  89. DWORD i, j, dwNumArg;
  90. PDWORD pdwTagType = NULL;
  91. TAG_TYPE pttTags[] = {{WINS_TOKEN_SERVER, TRUE, FALSE}};
  92. if( dwArgCount < dwCurrentIndex + 1 )
  93. {
  94. DisplayMessage(g_hModule, HLP_WINS_ADD_SERVER_EX);
  95. return ERROR_INVALID_PARAMETER;
  96. }
  97. dwNumArg = dwArgCount - dwCurrentIndex;
  98. pdwTagType = WinsAllocateMemory(dwNumArg*sizeof(DWORD));
  99. if( pdwTagType is NULL )
  100. {
  101. dwError = ERROR_NOT_ENOUGH_MEMORY;
  102. goto ErrorReturn;
  103. }
  104. //See if the first argument has tag. If so, then assume all arguments have tag.
  105. if( wcsstr(ppwcArguments[dwCurrentIndex], NETSH_ARG_DELIMITER) )
  106. {
  107. dwError = MatchTagsInCmdLine(g_hModule,
  108. ppwcArguments,
  109. dwCurrentIndex,
  110. dwArgCount,
  111. pttTags,
  112. NUM_TAGS_IN_TABLE(pttTags),
  113. pdwTagType);
  114. if (dwError isnot NO_ERROR)
  115. {
  116. dwError = ERROR_INVALID_PARAMETER;
  117. goto ErrorReturn;
  118. }
  119. }
  120. else
  121. {
  122. //
  123. // No tags in arguments. So assume order of arguments
  124. //
  125. for ( i = 0; i < dwNumArg; i++)
  126. {
  127. pdwTagType[i] = i;
  128. }
  129. }
  130. CommonReturn:
  131. if( dwError is NO_ERROR )
  132. DisplayMessage(g_hModule, EMSG_WINS_ERROR_SUCCESS);
  133. if( pdwTagType )
  134. {
  135. WinsFreeMemory(pdwTagType);
  136. pdwTagType = NULL;
  137. }
  138. return dwError;
  139. ErrorReturn:
  140. DisplayErrorMessage(EMSG_WINS_ADD_SERVER,
  141. dwError);
  142. goto CommonReturn;
  143. }
  144. DWORD
  145. HandleWinsDeleteServer(
  146. IN LPCWSTR pwszMachine,
  147. IN OUT LPWSTR *ppwcArguments,
  148. IN DWORD dwCurrentIndex,
  149. IN DWORD dwArgCount,
  150. IN DWORD dwFlags,
  151. IN LPCVOID pvData,
  152. OUT BOOL *pbDone
  153. )
  154. {
  155. return NO_ERROR;
  156. }
  157. DWORD
  158. HandleWinsShowServer(
  159. IN LPCWSTR pwszMachine,
  160. IN OUT LPWSTR *ppwcArguments,
  161. IN DWORD dwCurrentIndex,
  162. IN DWORD dwArgCount,
  163. IN DWORD dwFlags,
  164. IN LPCVOID pvData,
  165. OUT BOOL *pbDone
  166. )
  167. {
  168. return NO_ERROR;
  169. }