View Single Post
Old 3rd April 2008, 01:46   #16
Senior Member
Join Date: Apr 2006
Posts: 289
Send a message via ICQ to CancerFace
You can use NetShareDel to remove a share from a computer, assuming that you have admin/power user rights. Note however that this will also close any active connections to the share ...

Here is a very simple macro version of the above without any error checking:
!macro RemoveShare SHARENAME
System::Call /NOUNLOAD 'netapi32::NetShareDel(, *t ${SHARENAME}, i 0) i .r1'
${If} $1 <> 0
MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST 'There was an error removing the share!'

To use it call it from within your code:
!insertmacro RemoveShare "ShareName"

Let me know if this works (untested)
CancerFace is offline   Reply With Quote