Code implementation for shutting down an app

Source: Internet
Author: User

# Define iop_base 0xb1600000 // 0x56000000
Typedef struct {
Unsigned int rgpacon; // 00
Unsigned int rgpadat;
Unsigned int rpad1 [2];

Unsigned int rgpbcon; // 10
Unsigned int rgpbdat;
Unsigned int rgpbup;
Unsigned int rpad2;

Unsigned int rgpccon; // 20
Unsigned int rgpcdat;
Unsigned int rgpcup;
Unsigned int rpad3;

Unsigned int rgpdcon; // 30
Unsigned int rgpddat;
Unsigned int rgpdup;
Unsigned int rpad4;

Unsigned int rgpecon; // 40
Unsigned int rgpedat;
Unsigned int rgpeup;
Unsigned int rpad5;

Unsigned int rgpfcon; // 50
Unsigned int rgpfdat;
Unsigned int rgpfup;
Unsigned int rpad6;

Unsigned int rgpgcon; // 60
Unsigned int rgpgdat;
Unsigned int rgpgup;
Unsigned int rpad7;

Unsigned int rgphcon; // 70
Unsigned int rgphdat;
Unsigned int rgphup;
Unsigned int rpad8;
} Iopreg;
Volatile iopreg * g_piopregs = NULL;

Extern "C" _ declspec (dllimport) bool virtualcopy (lpvoid lpvdest, lpvoid lpvsrc,
DWORD cbsize, DWORD fdwprotect );
Void cstartdlg: onbutton1 ()
{

G_piopregs = (volatile iopreg *) virtualalloc (0, sizeof (iopreg), mem_reserve, page_noaccess );
If (g_piopregs = NULL)
{
Debugmsg (1, (text ("g_piopregs is not allocated/n/R ")));
// Return false;
}
If (! Virtualcopy (pvoid) g_piopregs, (pvoid) iop_base, sizeof (iopreg), page_readwrite | page_nocache ))
{
Debugmsg (1, (text ("g_piopregs is not mapped/n/R ")));
// Return false;
}

G_piopregs-> rgpccon & = ~ (0x3 <14) | (0x3 <12 );
G_piopregs-> rgpccon | = (0x1 <14) | (0x1 <12 );
G_piopregs-> rgpcup | = (0x1 <7) | (0x1 <6 );
G_piopregs-> rgpcdat | = (0x1 <7) | (0x1 <6 );

G_piopregs-> rgpbcon & = ~ (0x3 );
G_piopregs-> rgpbcon | = 0x1;
G_piopregs-> rgpbdat & = ~ (0x1 );
G_piopregs-> rgpbup | = 0x1;

G_piopregs-> rgpbcon & = ~ (0x3 <8 );
G_piopregs-> rgpbcon | = (0x1 <8 );
G_piopregs-> rgpbup | = (0x1 <4 );
G_piopregs-> rgpbdat & = ~ (0x1 <4 );

 
G_piopregs-> rgpgdat & = ~ (1 <3 );
G_piopregs-> rgpgup | = (0x1 <3 );
G_piopregs-> rgpgcon & = ~ (0x3 <6 );
G_piopregs-> rgpgcon | = (0x1 <6 );

G_piopregs-> rgpadat & = ~ (1 <13 );
G_piopregs-> rgpacon & = ~ (1 <13 );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.