Marco Gasi
asked on
Overlapped I/O operation is in progress
Hi all, Experts. I need your urgent support. I'm the author of a commercial application to backup Delphi settings. One Ā (only one) of my (few) customers has reported an Access violation error starting the app. Having added some tracking code to my app and with a patient collaboration of my customer, I've finally spotted the error where I fill a StringList with the special folders detected by this function:
The Windows error is "Overlapped I/O operation is in progress".
The filling operation is done this way: first, I fill several variables with correct values:
FPersonalDocuments := AddBackSlash(GetSpecialFol der(CSIDL_ PERSONAL)) ;
and so on...
AddBackSlash function doesn't need explanation, I suppose :-)
Then I add each valkue to SFList:
SFList.Add('PersDoc=' + FPersonalDocuments);
SFList.Add('DeskPath=' + FDesktopPath);
and so on...
This way my customer get Access violation. Then I added a sleep(100) for each SFList.Add:
SFList.Add('PersDoc=' + FPersonalDocuments);
sleep(100);
SFList.Add('DeskPath=' + FDesktopPath);
sleep(100);
and so on...
This time, we have no Access violation at all, but in the log file Overlapped message is still present and in fact all code after the StringList filling is not eexecuted and the program can't proceed....
I strongly hope someone can help mein this issue. I think this is a bad code design to detect and store Special folders but I don't know how to do it better....
Thanks to all. Any help will be appreciated.
Marco
function TfrmMain.GetSpecialFolder(const FolderId: integer): string;
var
ppidl : PItemIdList;
begin
If SHGetSpecialFolderLocation(0,FolderId,ppidl) = NOERROR then
begin
SetLength(Result,MAX_PATH);
If SHGetPathFromIDList(ppidl,PChar(Result)) then
SetLength(Result,StrLen(PChar(Result)))
else
Result := '';
end
else
Result := '';
end;
The Windows error is "Overlapped I/O operation is in progress".
The filling operation is done this way: first, I fill several variables with correct values:
FPersonalDocuments := AddBackSlash(GetSpecialFol
and so on...
AddBackSlash function doesn't need explanation, I suppose :-)
Then I add each valkue to SFList:
SFList.Add('PersDoc=' + FPersonalDocuments);
SFList.Add('DeskPath=' + FDesktopPath);
and so on...
This way my customer get Access violation. Then I added a sleep(100) for each SFList.Add:
SFList.Add('PersDoc=' + FPersonalDocuments);
sleep(100);
SFList.Add('DeskPath=' + FDesktopPath);
sleep(100);
and so on...
This time, we have no Access violation at all, but in the log file Overlapped message is still present and in fact all code after the StringList filling is not eexecuted and the program can't proceed....
I strongly hope someone can help mein this issue. I think this is a bad code design to detect and store Special folders but I don't know how to do it better....
Thanks to all. Any help will be appreciated.
Marco
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.