+ DWORD dwError = GetLastError();
+ if (hFile != INVALID_HANDLE_VALUE)
+ FindClose(hFile);
+ if (dwError != ERROR_NO_MORE_FILES)
+ {
+ LPVOID lpMsgBuf;
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
+ FORMAT_MESSAGE_FROM_SYSTEM|
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpMsgBuf,0,NULL);
+
+ gdcmErrorMacro("FindNextFile error. Error is " << (char *)lpMsgBuf
+ <<" for the directory : "<<dirName);
+ return -1;
+ }