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.

90 lines
1.9 KiB

  1. #include "uddi.xp.h"
  2. BOOL APIENTRY DllMain( HANDLE hModule,
  3. DWORD ul_reason_for_call,
  4. LPVOID lpReserved
  5. )
  6. {
  7. return TRUE;
  8. }
  9. void GetRegKeyStringValue( HKEY& hKey, const char* regKeyName, string& regKeyValue )
  10. {
  11. long nResult = ERROR_SUCCESS;
  12. DWORD dwType = REG_SZ;
  13. DWORD dwCount = 0;
  14. nResult = ::RegQueryValueExA( hKey,
  15. regKeyName,
  16. NULL,
  17. &dwType,
  18. NULL,
  19. &dwCount );
  20. if( dwCount && ( nResult == ERROR_SUCCESS ) && ( dwType == REG_SZ || dwType == REG_EXPAND_SZ ) )
  21. {
  22. char* pszBuf = new char[ dwCount ];
  23. if( NULL != pszBuf )
  24. {
  25. __try
  26. {
  27. nResult = ::RegQueryValueExA( hKey,
  28. regKeyName,
  29. NULL,
  30. &dwType,
  31. ( LPBYTE )pszBuf,
  32. &dwCount );
  33. regKeyValue = pszBuf;
  34. }
  35. __finally
  36. {
  37. delete [] pszBuf;
  38. pszBuf = NULL;
  39. }
  40. }
  41. }
  42. }
  43. string g_strUddiInstallDirectory = "";
  44. string& GetUddiInstallDirectory()
  45. {
  46. HKEY hKey = NULL;
  47. if( 0 == g_strUddiInstallDirectory.length() )
  48. {
  49. if( ::RegOpenKeyEx( HKEY_LOCAL_MACHINE,
  50. L"Software\\Microsoft\\UDDI",
  51. 0,
  52. KEY_QUERY_VALUE,
  53. &hKey ) == ERROR_SUCCESS )
  54. {
  55. GetRegKeyStringValue( hKey, "InstallRoot", g_strUddiInstallDirectory );
  56. if( g_strUddiInstallDirectory.length() != 0 )
  57. {
  58. g_strUddiInstallDirectory += "bin";
  59. }
  60. ::RegCloseKey( hKey );
  61. }
  62. }
  63. return g_strUddiInstallDirectory;
  64. }
  65. void ReportError( SRV_PROC *srvproc, LPCSTR sz, DWORD dwResult )
  66. {
  67. CHAR szErr[ MAXERROR ];
  68. _snprintf( szErr, MAXERROR, "%s failed with error code %d while executing the xsp\n", sz, dwResult );
  69. szErr[ MAXERROR - 1 ] = 0x00;
  70. srv_sendmsg( srvproc, SRV_MSG_ERROR, 0, XP_SRVMSG_SEV_ERROR, (DBTINYINT)0, NULL, 0, 0, szErr, SRV_NULLTERM );
  71. }
  72. ULONG __GetXpVersion()
  73. {
  74. return ODS_VERSION;
  75. }