Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
906 B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <windows.h>
  4. #define GetFileAttributeError 0xFFFFFFFF
  5. int NumberOfLinks(char *FileName);
  6. void __cdecl main (int ArgNumber, char **Args)
  7. {
  8. DWORD Attributes = GetFileAttributeError;
  9. int Counter = 0;
  10. char *File;
  11. if (ArgNumber > 1) {
  12. for (Counter = 1; Counter < ArgNumber; Counter++) {
  13. DWORD dwErr;
  14. Attributes = GetFileAttributes(Args[Counter]);
  15. if (Attributes == GetFileAttributeError) {
  16. dwErr = GetLastError();
  17. fprintf(stderr, "Error opening %s: %d\n", Args[Counter], dwErr);
  18. exit(dwErr);
  19. }
  20. File = _strlwr(_fullpath( NULL, Args[Counter], 0));
  21. fprintf(stdout, "%s: %d\n", File, NumberOfLinks(File));
  22. }
  23. } else {
  24. fprintf(stderr, "\nUsage: %s file [file]\n", Args[0]);
  25. }
  26. exit(0);
  27. }