You only allocated 1 character for each string with sizeof(CHAR16). If you have any StrLen at all, you've got a problem overwriting memory I think...
-Jaben >-----Original Message----- >From: S.Vieira [mailto:jwvsan...@outlook.com] >Sent: Tuesday, June 23, 2015 7:01 AM >To: edk2-devel@lists.sourceforge.net >Subject: [edk2] CHAR16 gets TRASH > >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 . > > >------------------------------------------------------------------------------ >Monitor 25 network devices or servers for free with OpManager! >OpManager is web-based network management software that monitors >network devices and physical & virtual servers, alerts via email & sms >for fault. Monitor 25 devices for free with no restriction. Download now >http://ad.doubleclick.net/ddm/clk/292181274;119417398;o >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical & virtual servers, alerts via email & sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel