Я использую этот code в Setup Inno создать семафор, но я получаю следующее сообщение об ошибке при компиляции: Compiler Error - Неизвестный тип 'TSecurityDescriptor'Ошибка компилятора - Неизвестный тип 'TSecurityDescriptor'
procedure CreateMutexes(const MutexName: String);
{ Creates the two mutexes checked for by the installer/uninstaller to see if
the program is still running.
One of the mutexes is created in the global name space (which makes it
possible to access the mutex across user sessions in Windows XP); the
other is created in the session name space (because versions of Windows NT
prior to 4.0 TSE don't have a global name space and don't support the
'Global\' prefix). }
const
SECURITY_DESCRIPTOR_REVISION = 1; { Win32 constant not defined in Delphi 3 }
var
SecurityDesc: TSecurityDescriptor;
SecurityAttr: TSecurityAttributes;
begin
{ By default on Windows NT, created mutexes are accessible only by the user
running the process. We need our mutexes to be accessible to all users, so
that the mutex detection can work across user sessions in Windows XP. To
do this we use a security descriptor with a null DACL. }
InitializeSecurityDescriptor(@SecurityDesc, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(@SecurityDesc, True, nil, False);
SecurityAttr.nLength := SizeOf(SecurityAttr);
SecurityAttr.lpSecurityDescriptor := @SecurityDesc;
SecurityAttr.bInheritHandle := False;
CreateMutex(@SecurityAttr, False, PChar(MutexName));
CreateMutex(@SecurityAttr, False, PChar('Global\' + MutexName));
end;
Я несколько новичок в Inno Setup, и я не уверен, как мне нужно определить этот тип, или если я должен включить другую библиотеку для этого типа.
Это код Delphi (в качестве примера того, что вы должны делать в установленном приложении). Предполагается, что вы просто укажете директиву «AppMutex» в сценарии установки Inno, как показано внизу страницы. – TLama
Это отвечает на мой вопрос! Спасибо, TLama. Как отметить, что ваш ответ - это решение? (Мой первый заданный вопрос о stackoverflow) –
Добро пожаловать! Ну, если бы я не ленился, я бы опубликовал ответ, который вы могли бы отметить как принятый. Но я ленив сделать это сейчас (извините :-), поэтому не стесняйтесь публиковать и принимать свой собственный (это разрешено), пусть кто-то другой отвечает или удаляет ваш вопрос, если вы хотите, поскольку это было просто неверное чтение этой статьи базы знаний, и трудно сказать, помогает ли она кому-то в будущем. Это на вас ;-) Спасибо за понимание и приветствуем StackOverflow! – TLama