genericunixprotocols/telnetsrv/src/uninstall.cpp
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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 *
       
    16 */
       
    17 
       
    18 #include <stdlib.h>
       
    19 #include <stdio.h>
       
    20 #include <string.h>
       
    21 #include <e32base.h>
       
    22 #include <utf.h>
       
    23 #include <swi\launcher.h>
       
    24 #include "uihandler.h"
       
    25 
       
    26 int main(int argc, char *argv[], char **/*envp*/)
       
    27 	{
       
    28 	
       
    29 	TInt err = KErrNone;
       
    30 	
       
    31 	if(argc!=2)
       
    32 		{
       
    33 		printf("Usage:\n");
       
    34 		printf("test_uninstall [UID in hexadecimal]\n");
       
    35 		printf("Example:\n");
       
    36 		printf("test_uninstall 10203040\n");
       
    37 		exit(KErrNone);
       
    38 		}
       
    39 	
       
    40 	TBuf16<10> desc;
       
    41 	
       
    42 	TPtrC8 src((const TUint8*)argv[1]);
       
    43 	
       
    44 	CnvUtfConverter::ConvertToUnicodeFromUtf8(desc, src);
       
    45 	
       
    46 	TLex conv(desc);
       
    47 	
       
    48 	TUint32 id;
       
    49 	
       
    50 	err = conv.Val(id,EHex);
       
    51 	
       
    52 	if(err==KErrNone)
       
    53 		{
       
    54 		TUid uid = TUid::Uid(id);
       
    55 		
       
    56 		CUIHandler* uiHandler = CUIHandler::NewL();
       
    57 
       
    58 		err = Swi::Launcher::Uninstall(*uiHandler, uid);
       
    59 		
       
    60 		delete uiHandler;
       
    61 		}
       
    62 	
       
    63 	printf("Return Code: %d\n",err);
       
    64 	
       
    65 	exit(err);
       
    66 	}
       
    67