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.

87 lines
2.3 KiB

  1. /////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1997 Active Voice Corporation. All Rights Reserved.
  4. //
  5. // Active Agent(r) and Unified Communications(tm) are trademarks of Active Voice Corporation.
  6. //
  7. // Other brand and product names used herein are trademarks of their respective owners.
  8. //
  9. // The entire program and user interface including the structure, sequence, selection,
  10. // and arrangement of the dialog, the exclusively "yes" and "no" choices represented
  11. // by "1" and "2," and each dialog message are protected by copyrights registered in
  12. // the United States and by international treaties.
  13. //
  14. // Protected by one or more of the following United States patents: 5,070,526, 5,488,650,
  15. // 5,434,906, 5,581,604, 5,533,102, 5,568,540, 5,625,676, 5,651,054.
  16. //
  17. // Active Voice Corporation
  18. // Seattle, Washington
  19. // USA
  20. //
  21. /////////////////////////////////////////////////////////////////////////////////////////
  22. // stdafx.cpp : source file that includes just the standard includes
  23. // stdafx.pch will be the pre-compiled header
  24. // stdafx.obj will contain the pre-compiled type information
  25. #include "stdafx.h"
  26. #ifdef _ATL_STATIC_REGISTRY
  27. #include <statreg.h>
  28. #include <statreg.cpp>
  29. #endif
  30. #include <atlimpl.cpp>
  31. #include <atlwin.cpp>
  32. #include <stdio.h>
  33. #include <atlctl.cpp>
  34. void GetToken( int nInd, LPCTSTR szDelim, LPTSTR szText, LPTSTR szToken )
  35. {
  36. _ASSERT( szDelim && szText && szToken );
  37. LPTSTR lpszStart = szText;
  38. bool bInQuotes = false;
  39. // Null out token string
  40. *szToken = NULL;
  41. // Look for token # nInd, ignore delimeter if in quotes
  42. while ( szText )
  43. {
  44. szText = _tcspbrk( szText, szDelim );
  45. if ( szText )
  46. {
  47. if ( *szText == _T('\"') )
  48. {
  49. bInQuotes = !bInQuotes;
  50. }
  51. else if ( !bInQuotes )
  52. {
  53. nInd--;
  54. if ( !nInd ) break;
  55. lpszStart = szText + 1;
  56. }
  57. szText++;
  58. }
  59. }
  60. // Grab token and strip any quotes off of it
  61. if ( *lpszStart == _T('\"') ) lpszStart++;
  62. if ( szText )
  63. {
  64. _tcsncpy( szToken, lpszStart, szText - lpszStart );
  65. szToken[szText - lpszStart] = NULL;
  66. }
  67. else
  68. {
  69. _tcscpy( szToken, lpszStart );
  70. }
  71. if ( szToken[_tcslen(szToken) - 1] == _T('\"') )
  72. szToken[_tcslen(szToken) - 1] = NULL;
  73. }