Archive: CreateMutexA question


CreateMutexA question
I am using the example from the docs to prevent multiple installers running simultaneously. From section C.11 Prevent Multiple Instances, you need to write this:


System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'


to stop multiple instances. What I do is roughly the following:


!define /date TIMESTAMP "%Y-%m-%d-%H-%M-%S"
!define PRODUCT_NAME "MyProduct"
!define INSTALLER_NAME "${PRODUCT_NAME}_${TIMESTAMP}_Setup.exe"


and in my .onInit function, I call


System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_NAME}") i .r1 ?e'


My question is, does ${INSTALLER_NAME} really get expanded out when it is passed to the CreateMutexA function?

Also, I have seen people using the following,


System::Call 'kernel32::CreateMutexA(i 0, i 0, t "$(^Name)") i .r1 ?e'


(for example here: http://nsis.sourceforge.net/Allow_on...aller_instance)

What does $(^Name) mean?

I suppose, basically, I am asking for guidance/tips on how to use this system call. I am not very familiar with mutexes.

Thanks.

Any defines get expanded on compile.
$(^Name) is a special language string containing the value of Name.

Stu