MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / IncrementSharedCount

Function IncrementSharedCount

src/utilities/install/install.cpp:649–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649USHORT IncrementSharedCount(const TEXT* filename, err_handler_t err_handler)
650{
651/**************************************
652 *
653 * I n c r e m e n t S h a r e d C o u n t
654 *
655 **************************************
656 *
657 * Functional description
658 * Increment the registry Shared Count of a module whose full path & file
659 * name is given in parameter 'filename'. Typically used to increment the
660 * shared count of the GDS32.DLL after its installation to WinSysDir. But
661 * can be used for just about any other shared component.
662 * User has to have enough rights to write to the HKLM key tree.
663 *
664 **************************************/
665
666 HKEY hkey;
667 LONG status = RegCreateKeyEx(HKEY_LOCAL_MACHINE, SHARED_KEY,
668 0, "", REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, 0, &hkey, 0);
669 if (status != ERROR_SUCCESS)
670 return (*err_handler) (status, "RegCreateKeyEx");
671
672 DWORD count = 0;
673 DWORD type, size = sizeof(count);
674 RegQueryValueEx(hkey, filename, NULL, &type,
675 reinterpret_cast<BYTE*>(&count), &size);
676
677 ++count;
678
679 status = RegSetValueEx(hkey, filename, 0, REG_DWORD,
680 reinterpret_cast<BYTE*>(&count), sizeof(DWORD));
681 if (status != ERROR_SUCCESS)
682 {
683 RegCloseKey(hkey);
684 return (*err_handler) (status, "RegSetValueEx");
685 }
686 RegCloseKey(hkey);
687
688 return FB_SUCCESS;
689}
690
691USHORT DecrementSharedCount(const TEXT* filename, bool sw_force, err_handler_t err_handler)
692{

Callers 2

CLIENT_installFunction · 0.85
CLIENT_removeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected