zhan313
Интересующийся
Offline
|
|
« : 12-03-2010 13:04 » |
|
Скажите что я делаю не так ? ReadDirectoryChangesW выскакивает по ошибке NO ACCESS
Monitor proc
invoke lstrcpy,addr FileName,addr dir invoke lstrlen,addr dir mov lenDir,eax mov SizeDir,eax add SizeDir,offset FileName invoke CreateFile, addr dir, FILE_LIST_DIRECTORY,\ FILE_SHARE_READ or FILE_SHARE_WRITE or FILE_SHARE_DELETE,\ NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL mov hDir,eax .If hDir == INVALID_HANDLE_VALUE invoke MessageBox,hWnd,addr T,addr AppName,MB_OK .endif RunDir: cmp Run,0 jne EndDir invoke ReadDirectoryChangesW, hDir, addr Buf, sizeof Buf,TRUE,\ FILE_NOTIFY_CHANGE_FILE_NAME, addr cb,NULL,NULL .If eax!=0 mov edx,offset Buf Next: push eax push edx cmp dword ptr[edx+4],FILE_ACTION_ADDED jne Other add edx,12 shr dword ptr [edx-4],1 mov esi,SizeDir add esi,dword ptr [edx-4] inc dword ptr [edx-4] invoke WideCharToMultiByte,CP_ACP,0,edx,\ dword ptr [edx-4],SizeDir,dword ptr [edx-4],NULL,NULL mov byte ptr[esi],0 invoke MessageBox, hWnd, addr FileName, addr AppName,MB_OK
Other: pop edx pop eax mov ebx,dword ptr[edx] add edx,ebx cmp ebx,0 jnz Next .else invoke MessageBox, hWnd, addr T1, NULL, MB_OK .endif jmp RunDir EndDir: invoke CloseHandle,hDir ret
Monitor endp
|