Android: Requesting root access in your app
תÌû£ºhttp://www.stealthcopter.com/blog/2010/01/android-requesting-root-access-in-your-app/
This snippet shows how root access can be requested inside an application in order to write a file into a place we do not have permission to access usually. Requesting root access will only work if your phone allows it, or it has been ‘rooted’ (hacked to allow superuser permissions).
view plaincopy to clipboardprint?
Process p;
try {
// Preform su to get root privledges
p = Runtime.getRuntime().exec("su");
// Attempt to write a file to a root-only
DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes("echo \"Do I have root?\" >/system/sd/temporary.txt\n");
// Close the terminal
os.writeBytes("exit\n");
os.flush();
try {
p.waitFor();
if (p.exitValue() != 255) {
// TODO Code to run on success
toastMessage("root");
}
else {
&nb
Ïà¹ØÎĵµ£º
http://www.cnblogs.com/byeday/archive/2009/10/04/1578034.html
ÎÊÌ⣺“Failed to access IIS metabase”½â¾ö
2009-08-14 17:03
ÔÒò£ºIISûÓÐ×¢²á
½â¾ö°ì·¨£º
ÔÚCMDÖнøÈëĿ¼C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727£¬ÔËÐÐaspnet_regiis
1¡¢aspnet_regiis -ga administrator£¨administratorΪµ ......
C#ÖзÃÎʹؼü×Ö£¨access keyword£©ÓÐÁ½¸ö£ºbase¡¢this
1.base
ÓÃÓÚ´ÓÅÉÉúÀàÖзÃÎÊ»ùÀàµÄ³ÉÔ±£¬°üÀ¨£º
a.µ÷ÓûùÀàÉÏÒѱ»ÆäËü·½·¨ÖØд£¨override£©µÄ·½·¨¡£
b.Ö¸¶¨´´½¨ÅÉÉúÀàʵÀýʱӦµ÷ÓõĻùÀ๹Ô캯Êý¡£
×¢Ò⣺¶Ô»ùÀàµÄ·ÃÎÊÖ»ÄÜ ......
×î½üϵͳÔËÐÐÖз¢ÏÖAccess 2003 °æ±¾ÖжԴý Null ºÍ ‘’ £¨¿Õ×Ö·û£©Ææ¹ÖÎÊÌ⣬ÖØÏÖ²½Ö裺
1¡¢´´½¨±ítabTest £»
2¡¢Ê¹ÓÃÉè¼ÆÊÓͼÌí¼ÓÁ½¸ö×ֶΠID £¬col1
Ãû³Æ
ÀàÐÍ
³¤¶È
˵Ã÷
ID
Number
Ö÷¼ü£¬×ÔÔö
Col1
char
1
ÎÞ
3¡¢Ê¹ÓÃsql Ìí¼ÓÈçÏÂÊý¾Ý
-- col1 ×Ö¶ÎÉèÖÃΪ null
INS ......
ÏîÄ¿ÖÐÓõ½Á˴˹¦ÄÜ¡£°Ñ´ó¸Å×ö·¨¸ú´ó¼Ò¹²ÏíÏ£¬Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú¡£Ò²¸ø×Ô¼º×ܽáһϣ¬¼¤Àø×Ô¼ºÔÙ½ÓÔÙÀ÷¡£ÏÂÃæÖв¿·Ö´úÂë±»ºº×ÖÌæ»»ÁË£¬Ö÷Òª¿¼Âǵ½¹«Ë¾µÄ²úƷȨ£¬Ï£ÍûÁ½⡣
/// <summary>
  ......
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Win32;
using Access = Microsoft.Office.Interop.Access;
namespace ImageAccess
{
static class Program
{
......