//
// NTPURE.C
// This program is a "pure" NtStyle program which can be run under
// Windows NT as well as under TNT DOS-Extender
//
#include <windows.h>

void print_them(atts)
DWORD atts;

{
    if (atts & FILE_ATTRIBUTE_ARCHIVE)
       printf("This file is an archive file.\n");
    if (atts & FILE_ATTRIBUTE_DIRECTORY)
       printf("This file is a directory.\n");
    if (atts & FILE_ATTRIBUTE_HIDDEN)
       printf("This file is hidden.\n");
    if (atts & FILE_ATTRIBUTE_NORMAL)
       printf("This file has no other atts set.\n");
    if (atts & FILE_ATTRIBUTE_READONLY)
       printf("This file is a read-only file.\n");
    if (atts & FILE_ATTRIBUTE_SYSTEM)
       printf("This file is an operating system file.\n");
    if (atts & FILE_ATTRIBUTE_TEMPORARY)
       printf("This file is a temporary file.\n");
}   

main()
{

    // get the current directory and look at it's attributes

    char Buff[64];
    int retcode = 0;
    DWORD attributes;

    retcode = GetCurrentDirectoryA(sizeof(Buff), Buff);

    if (!retcode)
        printf("NtStyle call failed\n");
    else
        {
            printf("Current Directory = '%s'\n", Buff);
            attributes = GetFileAttributes(Buff);
            if (attributes != 0xFFFFFFFF)
               {
                   printf("File Attributes for %s\n",Buff);
                   print_them(attributes);
               }
            else
               printf("GetFileAttributes call failed for %s\n", Buff);
            printf("\n");
        }

    // now look at the attributes of this source file

    attributes = GetFileAttributes("ntpure.c");
    if (attributes != 0xFFFFFFFF)
       {
           printf("File Attributes for ntpure.c\n");
           print_them(attributes);
           printf("\n");
       }
    else
       printf("GetFileAttributes call failed for ntpure.c\n");

    // and finally look at the file we're executing

    attributes = GetFileAttributes("ntpure.exe");
    if (attributes != 0xFFFFFFFF)
       {
           printf("File Attributes for ntpure.exe\n");
           print_them(attributes);
           printf("\n");
        }
    else
       printf("GetFileAttributes call failed for ntpure.exe\n");

    exit(0);
}

