22
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* Resolves the protection status for a Java file.
|
|
16 |
* Protection checks include:
|
|
17 |
* - Java SuperD
|
|
18 |
*
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
// INCLUDE FILES
|
|
25 |
#include <e32std.h>
|
|
26 |
#include <e32base.h> // CBase
|
|
27 |
#include <apmstd.h> // TDataType
|
|
28 |
#include <f32file.h> // RFs, RFile, CFileMan
|
|
29 |
|
|
30 |
#include <javasuperdparser.h>
|
|
31 |
|
|
32 |
#include "JavaProtectionResolver.h"
|
|
33 |
|
|
34 |
// EXTERNAL DATA STRUCTURES
|
|
35 |
|
|
36 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
37 |
|
|
38 |
// CONSTANTS
|
|
39 |
|
|
40 |
// MACROS
|
|
41 |
|
|
42 |
// LOCAL CONSTANTS AND MACROS
|
|
43 |
|
|
44 |
#if defined (__WINS__)
|
|
45 |
//_LIT( KFileProtTempDir, "c:\\system\\temp\\fileprot_temp\\");
|
|
46 |
_LIT( KFileProtTempDir, "\x43:\\system\\temp\\fileprot_temp\\");
|
|
47 |
#else
|
|
48 |
//_LIT( KFileProtTempDir, "d:\\system\\temp\\fileprot_temp\\");
|
|
49 |
_LIT( KFileProtTempDir, "\x44:\\system\\temp\\fileprot_temp\\");
|
|
50 |
#endif
|
|
51 |
|
|
52 |
// MODULE DATA STRUCTURES
|
|
53 |
|
|
54 |
// LOCAL FUNCTION PROTOTYPES
|
|
55 |
|
|
56 |
// FORWARD DECLARATIONS
|
|
57 |
|
|
58 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
// -----------------------------------------------------------------------------
|
|
63 |
// Factory
|
|
64 |
// -----------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
CJavaProtectionResolver* CJavaProtectionResolver::NewLC( RFs& aFs )
|
|
67 |
{
|
|
68 |
CJavaProtectionResolver* self = new ( ELeave ) CJavaProtectionResolver( aFs );
|
|
69 |
CleanupStack::PushL( self );
|
|
70 |
return self;
|
|
71 |
}
|
|
72 |
|
|
73 |
// -----------------------------------------------------------------------------
|
|
74 |
// C++ constructor
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
CJavaProtectionResolver::CJavaProtectionResolver( RFs& aFs ) :
|
|
78 |
iFs( aFs )
|
|
79 |
{
|
|
80 |
}
|
|
81 |
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
// Destructor
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
CJavaProtectionResolver::~CJavaProtectionResolver()
|
|
87 |
{
|
|
88 |
}
|
|
89 |
|
|
90 |
// -----------------------------------------------------------------------------
|
|
91 |
// CJavaProtectionResolver::CheckDRMStatus
|
|
92 |
// -----------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
TBool CJavaProtectionResolver::IsSuperDistributionPackageL( RFile& aFile )
|
|
95 |
{
|
|
96 |
TBool retVal( EFalse );
|
|
97 |
|
|
98 |
CFileMan* fileMan = CFileMan::NewL( iFs );
|
|
99 |
iFs.MkDir( KFileProtTempDir );
|
|
100 |
|
|
101 |
Java::CJavaSuperDParser* javaParser( NULL );
|
|
102 |
TRAPD( err, javaParser = Java::CJavaSuperDParser::NewL( iFs,
|
|
103 |
aFile,
|
|
104 |
KFileProtTempDir ) );
|
|
105 |
if ( !err )
|
|
106 |
{
|
|
107 |
retVal = ETrue;
|
|
108 |
}
|
|
109 |
delete javaParser;
|
|
110 |
|
|
111 |
/*TInt err =*/ fileMan->Delete( KFileProtTempDir /*, CFileMan::ERecurse*/ );
|
|
112 |
/*TInt err =*/ fileMan->RmDir( KFileProtTempDir );
|
|
113 |
delete fileMan;
|
|
114 |
|
|
115 |
return retVal;
|
|
116 |
}
|
|
117 |
|
|
118 |
// End of File
|