📄 generateunlockfile.cpp
字号:
// GenerateUnlockFile.cpp
//
// Copyright (c) 2003 Nokia Ltd. All rights reserved.
#include <e32cons.h>
#include <bacline.h>
#include <f32file.h>
#include <s32file.h>
#include <s32crypt.h>
#include "S60DeploymentLabConsts.h"
#include "FileEncryption.h"
// All messages written to this
LOCAL_D CConsoleBase* console;
// Parameter for __UHEAP_SETFAIL
// Allocation guaranteed to fail at this number of allocation attempts;
// i.e. if set to n, allocation fails on the nth attempt.
// NB only used in debug mode
#ifdef _DEBUG
LOCAL_D TInt allocFailNumber = 1;
#endif
// Function prototypes
LOCAL_C void GenerateUnlockFileL();
_LIT(KUnlockFilePath,"\\system\\apps\\S60DeploymentLabConsole\\Unlock.enc");
//////////////////////////////////////////////////////////////////////////////
//
// Main function called by E32
//
//////////////////////////////////////////////////////////////////////////////
GLDEF_C TInt E32Main()
{
// Get cleanup stack
CTrapCleanup* cleanup=CTrapCleanup::New();
// Some more initialization, then do the example
TRAPD(error,GenerateUnlockFileL());
// GenerateUnlockFileL() should never leave.
_LIT(KMsgPanic,"Error generating unlock file: ");
__ASSERT_ALWAYS(!error,User::Panic(KMsgPanic, error));
// destroy the cleanup stack
delete cleanup;
// return
return 0;
}
//////////////////////////////////////////////////////////////////////////////
//
//
//
//////////////////////////////////////////////////////////////////////////////
LOCAL_C void GenerateUnlockFileL()
{
// Initialize and call the example code under cleanup stack.
_LIT(KMsgExampleCode,"Generate Unlock File");
console = Console::NewL(KMsgExampleCode,TSize(KConsFullScreen,KConsFullScreen));
// Put console onto the cleanup stack.
CleanupStack::PushL(console);
CCommandLineArguments* args = CCommandLineArguments::NewL();
if (args->Count() > 1)
{
TPtrC imei = args->Arg(1);
_LIT(KIMEICode, "IMEI Code is %S\n");
console->Printf(KIMEICode, &imei);
CFileEncryption* fileEnc = CFileEncryption::NewLC();
fileEnc->CreateFileL(KUnlockFilePath, imei, KExerciseTitle);
CleanupStack::PopAndDestroy();
}
delete args;
// Continue
_LIT(KMsgPressAnyKey," [press any key]");
console->Printf(KMsgPressAnyKey);
console->Getch();
// Remove the console object from the cleanupstack
// and destroy it.
CleanupStack::PopAndDestroy();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -