Exemplo n.º 1
0
/* ----------------------------------------------------------------------
   TtaSetAttributeValue

   Changes the value of an attribute of type integer or enumerate.

   Parameters:
   attribute: the attribute to be modified.
   value: new value of the attribute.
   element: the element with which the attribute is associated,
   NULL if the attribute is not yet associated with an element.
   document: the document to which the element belongs.
   Must be 0 if element is NULL.
   ---------------------------------------------------------------------- */
void TtaSetAttributeValue (Attribute attribute, int value,
                           Element element, Document document)
{
  PtrAttribute        pAttr;
  ThotBool            ok;

  UserErrorCode = 0;
  pAttr = (PtrAttribute) attribute;
  ok = FALSE;
  if (attribute == NULL)
    TtaError (ERR_invalid_parameter);
  else if (pAttr->AeAttrType != AtEnumAttr && pAttr->AeAttrType != AtNumAttr)
    TtaError (ERR_invalid_attribute_value);
  else if (pAttr->AeAttrValue == 0 || AttrOfElement (attribute, element))
    {
      if (pAttr->AeAttrType == AtNumAttr)
        {
          if (abs (value) > 65535)
            /* the pivot form represents integers coded on two bytes */
            TtaError (ERR_invalid_attribute_value);
          else
            if (value != pAttr->AeAttrValue)
              ok = TRUE;
        }
      else
        {
          if (pAttr->AeAttrSSchema == NULL)
            TtaError (ERR_invalid_attribute_type);
          else if (value < 1)
            TtaError (ERR_invalid_attribute_value);
          else if (value > pAttr->AeAttrSSchema->SsAttribute->TtAttr[pAttr->AeAttrNum - 1]->AttrNEnumValues)
            TtaError (ERR_invalid_attribute_value);
          else if (value != pAttr->AeAttrValue)
            ok = TRUE;
        }
      if (ok)
        {
#ifndef NODISPLAY
          if (element != NULL)
            UndisplayInheritedAttributes ((PtrElement) element, pAttr,
                                          document, FALSE);
#endif
          pAttr->AeAttrValue = value;
#ifndef NODISPLAY
          if (element != NULL)
            DisplayAttribute ((PtrElement) element, pAttr, document);
#endif
        }
    }
}
logical DLInterpreter :: LAV ( )
{
  logical                 term = NO;
BEGINSEQ
  if ( !GetOption('h') )
  {
    DisplayAttribute(Parm(0));
  }
  else
  {
//                                 :   
    Output("List attribute values  : lav [varname|*] -Dn -Cn\n");
    if ( !GetOption('d') )                           LEAVESEQ

//                   1         2         3         4         5         6         7         8
//          12345678901234567890123456789012345678901234567890123456789012345678901234567890   
    Output("  The command shows the attribute value(s) for a property, parameter or local\n");
    Output("  or global variable. When an variable is complex, all attribute values for the\n");
    Output("  complex data type are displayed.\n");
    Output("  \n");
//                        -
    Output("  varname     - property path to be displayed\n");
    Output("  *           - display all attributes\n");
    Output("  -Dn         - redirect to other data source context\n");
    Output("  -Cn         - redirect to other collection in the hierarchy\n");
    Output("  \n");
    Output("Examples\n");
//                              :
    Output("  lav first_name    : display 'first_name' value for selected instance\n"); 
    Output("  lav parm1.name    : display the name attribute of parameter parm1\n");
    Output("  \n");
  }

ENDSEQ
  return(term);
}
Exemplo n.º 3
0
bool ParseCmd(char *cmd)
{
	char operate[100];
	sscanf(cmd,"%s",operate);




	if (!strcmp(operate,"fmt"))
	{
		printf("Disk Formating. Please Wait.\n");
		Format();
		printf("Disk Format Compleated.\n");
	}
	else if (!strcmp(operate,"dr"))
	{
		printf("%s\\ 的目录 \n\n",NowDirRoute);

		Dir();
	}
	else if (!strcmp(operate,"cp"))
	{
		isEditing=true;
		printf("复制中,请稍候.\n");
		char file1[1000],file2[1000];

		sscanf(cmd,"%*s %s %s",file1,file2);

		//char dir[1000];
		//char filename[10],extention[4];
		//sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);


		char filename[10],extention[4];
		char filename2[10],extention2[4];
		if (strchr(file1,':'))
		{
			char *p=strlen(file2)+file2;
			while(p!=file2)
			{
				if (*p=='\\')
				{
					break;
				}
				p--;
			}
			if (p!=file2)
			{
				p++;
				sscanf(p,"%[^.]%*c%s",filename,extention);
				p--;
				*p=0;
				ChangeNowDir(file2);
			}
			else
			{
				sscanf(p,"%[^.]%*c%s",filename,extention);
			}
			//sscanf(file2,"%[^.]%*c%s",filename,extention);
			Copy(3,file1,0,filename,extention);
		}
		else if (strchr(file2,':'))
		{
			char *p=strlen(file1)+file1;
			while(p!=file1)
			{
				if (*p=='\\')
				{
					break;
				}
				p--;
			}
			if (p!=file1)
			{
				p++;
				sscanf(p,"%[^.]%*c%s",filename,extention);
				p--;
				*p=0;
				ChangeNowDir(file1);
			}
			else
			{
				sscanf(p,"%[^.]%*c%s",filename,extention);
			}
			//sscanf(file2,"%[^.]%*c%s",filename,extention);
			Copy(2,filename,extention,file2,0);
		}
		else
		{
			if (!strchr(file1,'\\')&&!strchr(file2,'\\'))
			{
				sscanf(file1,"%[^.]%*c%s",filename,extention);
				sscanf(file2,"%[^.]%*c%s",filename2,extention2);
				Copy(1,filename,extention,filename2,extention2);
			}

			else
			{
				char *p=strlen(file1)+file1;
				while(p!=file1)
				{
					if (*p=='\\')
					{
						break;
					}
					p--;
				}
				if (p!=file1)
				{
					p++;
					sscanf(p,"%[^.]%*c%s",filename,extention);
					p--;
					*p=0;
					ChangeNowDir(file1);
				}
				else
				{
					sscanf(p,"%[^.]%*c%s",filename,extention);
				}
				char ctmp[100]="c:\\";
				strcat(ctmp,filename);
				strcat(ctmp,"_blegtmp.");
				strcat(ctmp,extention);
				Copy(2,filename,extention,ctmp,0);

				ChangeNowDir(OriDir);

				char *q=strlen(file2)+file2;
				while(q!=file2)
				{
					if (*q=='\\')
					{
						break;
					}
					q--;
				}
				if (q!=file2)
				{
					q++;
					sscanf(q,"%[^.]%*c%s",filename,extention);
					q--;
					*q=0;
					ChangeNowDir(file2);
				}
				else
				{
					sscanf(q,"%[^.]%*c%s",filename,extention);
				}

				Copy(3,ctmp,0,filename,extention);
				//ChangeNowDir(OriDir);

			}
			
		}
		ChangeNowDir(OriDir);
		printf("文件复制完成。\n");
		isEditing=false;
	}
	else if (!strcmp(operate,"user"))
	{
		printf("请输入新用户名:");
		while(1)
		{
			char tmp[100];
			scanf("%s",tmp);
			if (strlen(tmp)<10)
			{
				strcpy(Username,tmp);
				break;
			}
			printf("用户名不能超过 10 个字符,请重新输入新用户名:");
		}
		
		
		bool correct=false;
		int len=0;
		char tmp[20];
		char tmp2[20];
		memset(tmp2,0,20);
		memset(tmp,0,20);
		while(!correct)
		{
			printf("请输入新密码:");
			while(1)
			{			
				char ch=getch();
				if (!isdigit(ch)&&!isalpha(ch)&&ch!=13)
				{
					continue;
				}
				if (ch==13)
				{
					if (len>=10)
					{
						printf("\n密码必须小于 10 个字符,请重新输入新密码:");
						len=0;
						memset(tmp,0,20);
						continue;
					}
					else
					{
						printf("\n请再次输入新密码:");
						len=0;
						break;
					}
				}
				else
				{
					tmp[len++]=ch;
					printf("*");
				}
				
			}

			while(1)
			{			
				char ch=getch();
				if (!isdigit(ch)&&!isalpha(ch)&&ch!=13)
				{
					continue;
				}
				if (ch==13)
				{
					if (!strcmp(tmp,tmp2))
					{
						printf("\n新密码已确认。\n");
						getchar();
						correct=true;
						break;
					}
					else
					{
						   break;
					}
				}
				tmp2[len++]=ch;
				printf("*");
			}
		}

	}
	else if(!strcmp(operate,"rm"))
	{
		char dir[1000];
		char filename[10],extention[4];
		sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);
		char *p=strlen(dir)+dir;
		while(p!=dir)
		{
			if (*p=='\\')
			{
				break;
			}
			p--;
		}
		if (p!=dir)
		{
			p++;
			sscanf(p,"%[^.]%*c%s",filename,extention);
			p--;
			*p=0;
			ChangeNowDir(dir);
		}
		else
		{
			sscanf(p,"%[^.]%*c%s",filename,extention);
		}

		bool succ=Delete(1,filename,extention);
		if(succ)
			printf("一个文件已被删除.\n");
		ChangeNowDir(OriDir);
	}

	else if (!strcmp(operate,"block"))
	{
		printf("文件所使用的数据块有:\n");
		char dir[1000];
		char filename[10],extention[4];
		sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);
		char *p=strlen(dir)+dir;
		while(p!=dir)
		{
			if (*p=='\\')
			{
				break;
			}
			p--;
		}
		if (p!=dir)
		{
			p++;
			sscanf(p,"%[^.]%*c%s",filename,extention);
			p--;
			*p=0;
			ChangeNowDir(dir);
		}
		else
		{
			sscanf(p,"%[^.]%*c%s",filename,extention);
		}

		BlockOfFile(filename,extention);
		ChangeNowDir(OriDir);
	}

	else if (!strcmp(operate,"rmdir"))
	{
		char dir[1000];
		sscanf(cmd,"%*s %s",dir);
		bool succ=Delete(2,dir,0);
		if (succ)
		{
			printf("一个文件夹已被删除.\n");
		}
	}
	else if (!strcmp(operate,"deleted"))
	{
		printf("回收站:\n");
		Delete(3,0,0);
	}
	else if (!strcmp(operate,"type"))
	{
		char dir[1000];
		char filename[10],extention[4];
		sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);
		char *p=strlen(dir)+dir;
		while(p!=dir)
		{
			if (*p=='\\')
			{
				break;
			}
			p--;
		}
		if (p!=dir)
		{
			p++;
			sscanf(p,"%[^.]%*c%s",filename,extention);
			p--;
			*p=0;
			ChangeNowDir(dir);
		}
		else
		{
			sscanf(p,"%[^.]%*c%s",filename,extention);
		}
		int fid=GetFileID(filename,extention);
		Display(1,fid);

		ChangeNowDir(OriDir);
	}
	else if (!strcmp(operate,"more"))
	{
		/*
		char dir[1000];
		char filename[10],extention[4];
		sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);
		char *p=strlen(dir)+dir;
		while(p!=dir)
		{
			if (*p=='\\')
			{
				break;
			}
			p--;
		}
		if (p!=dir)
		{
			p++;
			sscanf(p,"%[^.]%*c%s",filename,extention);
			p--;
			*p=0;
			ChangeNowDir(dir);
		}
		else
		{
			sscanf(p,"%[^.]%*c%s",filename,extention);
		}
		
		int fid=GetFileID(filename,extention);
		Display(2,fid);

		ChangeNowDir(OriDir);
		*/
		//system("dir");
		char filename[10],extention[4];
		sscanf(cmd,"%*s %[^.]%*c%s",filename,extention);
		char tmp[100];
		memset(tmp,0,100);
		strcat(tmp,"c:\\");
		strcat(tmp,filename);
		strcat(tmp,".");
		strcat(tmp,extention);
		Copy(2,filename,extention,tmp,0);
		char ccmd[100]="more ";
		strcat(ccmd,tmp);
		system(ccmd);
		
	}
	else if(!strcmp(operate,"att"))
	{
		char dir[1000];
		char filename[10],extention[4];
		sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);
		char *p=strlen(dir)+dir;
		while(p!=dir)
		{
			if (*p=='\\')
			{
				break;
			}
			p--;
		}
		if (p!=dir)
		{
			p++;
			sscanf(p,"%[^.]%*c%s",filename,extention);
			p--;
			*p=0;
			ChangeNowDir(dir);
		}
		else
		{
			sscanf(p,"%[^.]%*c%s",filename,extention);
		}

		DisplayAttribute(filename,extention);

		ChangeNowDir(OriDir);
	}
	else if (!strcmp(operate,"help"))
	{

	}
	else if (!strcmp(operate,"cd"))
	{
		char Dir[1000];
		sscanf(cmd,"%*s %s",Dir);
		ChangeNowDir(Dir);
	}
	else if (!strcmp(operate,"close"))
	{
		Close();
	}
	else if (!strcmp(operate,"new"))
	{
		char dir[1000];
		char filename[10],extention[4];
		sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);
		char *p=strlen(dir)+dir;
		while(p!=dir)
		{
			if (*p=='\\')
			{
				break;
			}
			p--;
		}
		if (p!=dir)
		{
			p++;
			sscanf(p,"%[^.]%*c%s",filename,extention);
			p--;
			*p=0;
			ChangeNowDir(dir);
		}
		else
		{
			sscanf(p,"%[^.]%*c%s",filename,extention);
		}

		bool succ=New(1,filename,extention);
		if (succ)
		{
			printf("文件创建成功。\n");
		}

		ChangeNowDir(OriDir);
		
	}
	else if (!strcmp(operate,"aaa"))
	{
		printf("%d\n",TotalFileNum);
		printf("%s\n",NowDirRoute);
	}
	else if (!strcmp(operate,"newdir"))
	{
		char filename[10];
		sscanf(cmd,"%*s %s",filename);
		bool succ=New(2,filename,0);
		if (succ)
		{
			printf("目录创建成功。\n");
		}
	}
	else if (!strcmp(operate,"editw"))
	{
		isEditing=true;
		char dir[1000];
		char filename[10],extention[4];
		sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);
		char *p=strlen(dir)+dir;
		while(p!=dir)
		{
			if (*p=='\\')
			{
				break;
			}
			p--;
		}
		if (p!=dir)
		{
			p++;
			sscanf(p,"%[^.]%*c%s",filename,extention);
			p--;
			*p=0;
			ChangeNowDir(dir);
		}
		else
		{
			sscanf(p,"%[^.]%*c%s",filename,extention);
		}
		
		Edit(1,filename,extention);
		printf("1      Files Saved.\n");

		ChangeNowDir(OriDir);
		isEditing=false;
	}


	else if (!strcmp(operate,"edita"))
	{
		isEditing=true;
		char dir[1000];
		char filename[10],extention[4];
		sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);
		char *p=strlen(dir)+dir;
		while(p!=dir)
		{
			if (*p=='\\')
			{
				break;
			}
			p--;
		}
		if (p!=dir)
		{
			p++;
			sscanf(p,"%[^.]%*c%s",filename,extention);
			p--;
			*p=0;
			ChangeNowDir(dir);
		}
		else
		{
			sscanf(p,"%[^.]%*c%s",filename,extention);
		}

		Edit(2,filename,extention);
		printf("1      Files Saved.\n");

		ChangeNowDir(OriDir);
		isEditing=false;
	}

	else if (!strcmp(operate,"rc"))
	{

		char dir[1000];
		char filename[10],extention[4];
		sscanf(cmd,"%*s %s",dir);

		char OriDir[1000];
		strcpy(OriDir,NowDirRoute);
		char *p=strlen(dir)+dir;
		while(p!=dir)
		{
			if (*p=='\\')
			{
				break;
			}
			p--;
		}
		if (p!=dir)
		{
			p++;
			sscanf(p,"%[^.]%*c%s",filename,extention);
			p--;
			*p=0;
			ChangeNowDir(dir);
		}
		else
		{
			sscanf(p,"%[^.]%*c%s",filename,extention);
		}

		recovery(filename,extention);
		printf("文件已恢复。\n");
		ChangeNowDir(OriDir);
	}
	else if (!strcmp(operate,"space"))
	{
// #ifdef _1M_
// 		printf("总空间:  1048576 Bytes.可用空间: %d Bytes.剩余空间: %d Bytes.\n",FDBNum*4096,FreeFDBNum*4096);
// #endif
#ifdef _1G_
		printf("总空间:  1073741824 Bytes.可用空间: %d Bytes.剩余空间: %d Bytes.\n",FDBNum*4096,FreeFDBNum*4096);
#endif
		
	}
	else if (!strcmp(operate,"tree"))
	{
		printf("%s 的文件结构树:\n",NowDirRoute);
		printf(".\n");
		Tree(1,NowDirFid);
	}
	else
	{
		printf("illegal instruction\n");
	}
	return true;
}
Exemplo n.º 4
0
/* ----------------------------------------------------------------------
   TtaSetAttributeText

   Changes the value of an attribute of type text.
   Parameters:
   attribute: the attribute to be modified.
   buffer: character string representing the new value of the attribute.
   element: the element with which the attribute is associated,
   NULL if the attribute is not yet associated with an element.
   document: the document to which the element belongs.
   Must be 0 if element is NULL.
   ---------------------------------------------------------------------- */
void TtaSetAttributeText (Attribute attribute, const char* buffer,
                          Element element, Document document)
{
  int                 lg;
  PtrAttribute        pAttr;
#ifndef NODISPLAY
  PtrAttribute        pPrevAttr, pA;
#endif /* NODISPLAY */
  Language	      lang;

  UserErrorCode = 0;
  pAttr = (PtrAttribute) attribute;
  if (pAttr == NULL)
    TtaError (ERR_invalid_parameter);
  else if (pAttr->AeAttrType != AtTextAttr)
    TtaError (ERR_invalid_attribute_type);
  else if (AttrOfElement (attribute, element))
    {
#ifndef NODISPLAY
      if (element != NULL)
        {
          /* detach temporarily attribute from element */
          pPrevAttr = NULL;
          pA = ((PtrElement) element)->ElFirstAttr;
          while (pA && pA != pAttr)
            {
              pPrevAttr = pA;
              pA = pA->AeNext;
            }
          if (pA)
            {
              if (pPrevAttr)
                pPrevAttr->AeNext = pA->AeNext;
              else
                ((PtrElement) element)->ElFirstAttr = pA->AeNext;
            }
          /* de-apply all presentation rules related to the attribute */
          UndisplayInheritedAttributes ((PtrElement) element, pAttr, document,
                                        TRUE);
          /* reattach attribute to element */
          if (pA)
            {
              if (pPrevAttr)
                pPrevAttr->AeNext = pAttr;
              else
                ((PtrElement) element)->ElFirstAttr = pAttr;
            }
        }
#endif
      if (pAttr->AeAttrText == NULL)
        GetTextBuffer (&pAttr->AeAttrText);
      else
        ClearText (pAttr->AeAttrText);
      /* Sets the new value */
      CopyStringToBuffer ((unsigned char *)buffer, pAttr->AeAttrText, &lg);
      if (pAttr->AeAttrNum == 1)
        /* language attribute */
        {
          lang = TtaGetLanguageIdFromName (buffer);
#ifdef NODISPLAY
          ChangeLanguageLeaves((PtrElement) element, lang);
#else
          ChangeLanguage (LoadedDocument[document - 1],
                          (PtrElement) element, lang, FALSE);
#endif
        }
#ifndef NODISPLAY
      if (element != NULL)
        DisplayAttribute ((PtrElement) element, pAttr, document);
#endif
    }
}
Exemplo n.º 5
0
/* ----------------------------------------------------------------------
   TtaAttachAttribute

   Attaches an attribute to an element.
   Parameters:
   element: the element to which the attribute has to be attached.
   attribute: the attribute to be attached.
   document: the document to which the element belongs.
   ---------------------------------------------------------------------- */
void TtaAttachAttribute (Element element, Attribute attribute, Document document)
{
  PtrAttribute        pAttr;
  PtrDocument         pDoc;
  ThotBool            obligatory;

  UserErrorCode = 0;
  if (element == NULL || attribute == NULL ||
      ((PtrElement) element)->ElStructSchema == NULL)
    TtaError (ERR_invalid_parameter);
  else if (document < 1 || document > MAX_DOCUMENTS)
    TtaError (ERR_invalid_document_parameter);
  else
    {
      pDoc = LoadedDocument[document - 1];
      if (pDoc == NULL)
        TtaError (ERR_invalid_document_parameter);
      else if (AttributeValue ((PtrElement) element,
                               (PtrAttribute) attribute) != NULL)
        /* parameter document is correct */
        /* has the element an attribute of the same type ? */
        /* yes, error */ 
        TtaError (ERR_duplicate_attribute);
      else if ((pDoc)->DocCheckingMode & STR_CHECK_MASK &&
               !CanAssociateAttr ((PtrElement) element, NULL, 
                                  (PtrAttribute) attribute, &obligatory))
        /* can wa apply the attribute to the element ? */
        /* no, error */
        TtaError (ERR_attribute_element_mismatch);
      else
        {
#ifndef NODISPLAY
          UndisplayInheritedAttributes ((PtrElement) element,
                                        (PtrAttribute) attribute, document, FALSE);
#endif
          if (((PtrElement) element)->ElFirstAttr == NULL)
            ((PtrElement) element)->ElFirstAttr = (PtrAttribute) attribute;
          else
            {
              pAttr = ((PtrElement) element)->ElFirstAttr;
              while (pAttr->AeNext != NULL)
                pAttr = pAttr->AeNext;
              pAttr->AeNext = (PtrAttribute) attribute;
            }
          /* update the menu attributes */
          if (pDoc == SelectedDocument &&
              (PtrElement) element == FirstSelectedElement)
            if (ThotLocalActions[T_chattr] != NULL)
              (*(Proc1)ThotLocalActions[T_chattr]) ((void *)pDoc);
	   
          pAttr = (PtrAttribute) attribute;
          pAttr->AeNext = NULL;
          pAttr->AeDefAttr = FALSE;
          if (pAttr->AeAttrType == AtReferenceAttr)
            if (pAttr->AeAttrReference != NULL)
              pAttr->AeAttrReference->RdElement = (PtrElement) element;
#ifndef NODISPLAY
          DisplayAttribute ((PtrElement) element, pAttr, document);
#endif
        }
    }
}
Exemplo n.º 6
0
/*---------------------------------------------------------------------------
//		Main関数
//-------------------------------------------------------------------------*/
int main(void)
{
	int					retCode;
	HANDLE				diskHandle = NULL;
	SMARTATTRIBUTESDATA	attrData;
	SMARTHRESHOLDSDATA	thData;

	memset(&attrData, 0, sizeof(SMARTATTRIBUTESDATA));
	memset(&thData, 0, sizeof(SMARTHRESHOLDSDATA));
	/*------デバイスクラスのインターフェースハンドルの取得-----------------*/
	/*------ディスク0のハンドルの作成--------------------------------------*/
    diskHandle = CreateFile("\\\\.\\PhysicalDrive0",
							GENERIC_READ | GENERIC_WRITE,
							FILE_SHARE_READ | FILE_SHARE_WRITE,
							NULL, OPEN_EXISTING, 0, NULL);
	if(INVALID_HANDLE_VALUE == diskHandle) {
		printf("物理ドライブのハンドル作成に失敗しました\n");
		return -1;
    }

	/*------SMARTコマンドがサポートされているか確認する--------------------*/
	if (0 == isSupportedSMART(diskHandle)) {
		printf("SMARTがサポートされていません\n");
		CloseHandle(diskHandle);
		return -1;
	}

	/*------SMART機能を無効にする------------------------------------------*/
	printf("SMART機能の無効化を行います\n");
	if (0 != smartDisable(diskHandle)) {
		printf("SMART機能の無効化に失敗しました\n");
	}

	/*------SMART機能を有効にする------------------------------------------*/
	printf("SMART機能の有効化を行います\n");
	if (0 != smartEnable(diskHandle)) {
		printf("SMART機能の有効化に失敗しました\n");
		CloseHandle(diskHandle);
		return -1;
	}

	/*------SMART自動セーブ機能を無効にする--------------------------------*/
	printf("SMART自動セーブ機能の無効化を行います\n");
	if (0 != smartEnableDisableAutoSave(diskHandle, 0)) {
		printf("SMART自動セーブ機能の無効化に失敗しました\n");
	}

	/*------SMART自動セーブ機能を有効にする--------------------------------*/
	printf("SMART自動セーブ機能の有効化を行います\n");
	if (0 != smartEnableDisableAutoSave(diskHandle, 0xf1)) {
		printf("SMART自動セーブ機能の有効化に失敗しました\n");
	}

	/*------SMARTの状態取得を行う------------------------------------------*/
	printf("SMARTの状態取得を行います\n");
	retCode = smartReturnStatus(diskHandle);
	switch(retCode)
	{
		case 0:
			printf("正常状態です\n");
			break;
		case 1:
			printf("問題があります\n");
			break;
		default:
			printf("SMARTの状態取得に失敗しました\n");
	}

	/*------SMARTの属性値を取得する----------------------------------------*/
	printf("SMARTの属性値の取得を行います\n");
	if (0 != smartReadAttributeValues(diskHandle, &attrData)) {
		printf("SMARTの属性値の取得に失敗しました\n");
		CloseHandle(diskHandle);
		return -1;
	}

	/*------SMARTの閾値を取得する------------------------------------------*/
	printf("SMARTの閾値の取得を行います\n");
	if (0 != smartReadAttributeThresholds(diskHandle, &thData)) {
		printf("SMARTの閾値の取得に失敗しました\n");
	}

	/*------SMARTの属性値と閾値を表示する----------------------------------*/
	DisplayAttribute(&attrData, &thData);

	/*------終了処理-------------------------------------------------------*/
	CloseHandle(diskHandle);

	return 0;
}