1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/* * Rule: FIO42-C * Source: wiki * Status: FAIL - Should trigger FIO42-C violation */ #include <Windows.h> int func(LPCTSTR filename) { HANDLE hFile = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (INVALID_HANDLE_VALUE == hFile) { return -1; } /* ... */ return 0; }