S.Vieira
2015-06-23 14:01:18 UTC
Hi everyone
I'm having a problem with CHAR16.
I have a function :
VOID
FileLogInfo(
EFI_HANDLE ImageHandle,
CHAR16 *SerialNumberFile,
CHAR16 * ModelNumber,
CHAR16 * FirRevision
);
When passing the parameters to function:
CHAR16 *stringModel = NULL;
CHAR16 *stringFw = NULL;
CHAR16 *stringRv = NULL;
UINT8 *Model;
UINT8 *Fw;
UINT8 *Rv;
gBS->AllocatePool(EfiBootServicesData,
sizeof(UINT8),
(VOID **)&Model);
gBS->AllocatePool(EfiBootServicesData,
sizeof(UINT8),
(VOID **)&Fw);
gBS->AllocatePool(EfiBootServicesData,
sizeof(UINT8),
(VOID **)&Rv);
gBS->AllocatePool(EfiBootServicesData,
sizeof(CHAR16),
(VOID **)&stringModel);
gBS->AllocatePool(EfiBootServicesData,
sizeof(CHAR16),
(VOID **)&stringFw);
gBS->AllocatePool(EfiBootServicesData,
sizeof(CHAR16),
(VOID **)&stringRv);
AtaSmartShortTest(deviceCurrentArray[Option],
deviceCurrentPortArray[Option],
ATA_VALUE_PORT,
Model,
Fw,
Rv);
HexToStringBuffer(Model,stringModel);
HexToStringBuffer(Fw,stringFw);
HexToStringBuffer(Rv,stringRv);
gBS->FreePool((VOID **)&Model);
gBS->FreePool((VOID **)&Fw);
gBS->FreePool((VOID **)&Rv);
FileLogInfo(ImageHandle,stringFw,stringModel,stringRv);
gBS->FreePool((VOID **)&stringModel);
gBS->FreePool((VOID **)&stringRv);
When I call Print() before FileLogInfo the CHAR16 strings are right, but
when call Print inside FileLogInfo the CHAR16 strings are wrong.
For example, if the stringModel has StrLen equal 15, inside FileLogInfo i
will have StrLen equal 22, sometimes gets trash and sometimes not .
I'm having a problem with CHAR16.
I have a function :
VOID
FileLogInfo(
EFI_HANDLE ImageHandle,
CHAR16 *SerialNumberFile,
CHAR16 * ModelNumber,
CHAR16 * FirRevision
);
When passing the parameters to function:
CHAR16 *stringModel = NULL;
CHAR16 *stringFw = NULL;
CHAR16 *stringRv = NULL;
UINT8 *Model;
UINT8 *Fw;
UINT8 *Rv;
gBS->AllocatePool(EfiBootServicesData,
sizeof(UINT8),
(VOID **)&Model);
gBS->AllocatePool(EfiBootServicesData,
sizeof(UINT8),
(VOID **)&Fw);
gBS->AllocatePool(EfiBootServicesData,
sizeof(UINT8),
(VOID **)&Rv);
gBS->AllocatePool(EfiBootServicesData,
sizeof(CHAR16),
(VOID **)&stringModel);
gBS->AllocatePool(EfiBootServicesData,
sizeof(CHAR16),
(VOID **)&stringFw);
gBS->AllocatePool(EfiBootServicesData,
sizeof(CHAR16),
(VOID **)&stringRv);
AtaSmartShortTest(deviceCurrentArray[Option],
deviceCurrentPortArray[Option],
ATA_VALUE_PORT,
Model,
Fw,
Rv);
HexToStringBuffer(Model,stringModel);
HexToStringBuffer(Fw,stringFw);
HexToStringBuffer(Rv,stringRv);
gBS->FreePool((VOID **)&Model);
gBS->FreePool((VOID **)&Fw);
gBS->FreePool((VOID **)&Rv);
FileLogInfo(ImageHandle,stringFw,stringModel,stringRv);
gBS->FreePool((VOID **)&stringModel);
gBS->FreePool((VOID **)&stringRv);
When I call Print() before FileLogInfo the CHAR16 strings are right, but
when call Print inside FileLogInfo the CHAR16 strings are wrong.
For example, if the stringModel has StrLen equal 15, inside FileLogInfo i
will have StrLen equal 22, sometimes gets trash and sometimes not .