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.

100 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1991-1993 Microsoft Corporation
  3. Module Name:
  4. ConfClos.c
  5. Abstract:
  6. This module contains NetpCloseConfigData. This is one of the new net
  7. config helpers.
  8. Author:
  9. John Rogers (JohnRo) 26-Nov-1991
  10. Environment:
  11. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  12. Requires ANSI C extensions: slash-slash comments, long external names.
  13. Revision History:
  14. 26-Nov-1991 JohnRo
  15. Created this routine, to prepare for revised config handlers.
  16. 11-Feb-1992 JohnRo
  17. Added support for using the real Win32 registry.
  18. Added support for FAKE_PER_PROCESS_RW_CONFIG handling.
  19. 25-Feb-1993 JohnRo
  20. RAID 12914: _tell caller if they never opened handle.
  21. --*/
  22. // These must be included first:
  23. #include <nt.h> // NT definitions
  24. #include <ntrtl.h> // NT Rtl structures
  25. #include <nturtl.h> // NT Rtl structures
  26. #include <windows.h> // Needed by <configp.h> and <winreg.h>
  27. #include <lmcons.h> // LAN Manager common definitions
  28. #include <netdebug.h> // (Needed by config.h)
  29. // These may be included in any order:
  30. #include <config.h> // My prototype, LPNET_CONFIG_HANDLE.
  31. #include <configp.h> // NET_CONFIG_HANDLE.
  32. #include <lmerr.h> // NERR_Success.
  33. #include <netlib.h> // NetpMemoryAllocate(), etc.
  34. NET_API_STATUS
  35. NetpCloseConfigData(
  36. IN OUT LPNET_CONFIG_HANDLE ConfigHandle
  37. )
  38. /*++
  39. Routine Description:
  40. This function closes the system configuration file.
  41. WARNING: Closing the same config handle twice can be nasty. There
  42. is no way to detect this at the moment.
  43. Arguments:
  44. ConfigHandle - Is the handle returned from NetpOpenConfigData().
  45. Return Value:
  46. NET_API_STATUS - NERR_Success or reason for failure.
  47. --*/
  48. {
  49. NET_CONFIG_HANDLE * MyHandle = ConfigHandle; // conv from opaque type
  50. // Did caller forget to open?
  51. if (ConfigHandle == NULL)
  52. {
  53. return (ERROR_INVALID_PARAMETER);
  54. }
  55. {
  56. LONG RegStatus;
  57. RegStatus = RegCloseKey( MyHandle->WinRegKey );
  58. NetpAssert( RegStatus == ERROR_SUCCESS );
  59. }
  60. NetpMemoryFree( MyHandle );
  61. return (NERR_Success);
  62. }