我有一个DLL,我使用AllocConsole()和cout来显示数据以进行调试.
它曾经工作正常但是因为我将我的编译器(Visual Studio 2012)更新到最新的dll只显示控制台而不是print/couts.
我不明白为什么会发生这种情况.
有任何想法吗?
我的部分代码
__declspec(dllexport) INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved)
{
switch(Reason)
{
case DLL_PROCESS_ATTACH:
AllocConsole();
DisableThreadLibraryCalls(hDLL);
//
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)pSend, MySend);
if(DetourTransactionCommit() == NO_ERROR)
cout << "[" << MySend << "] successfully detoured." << endl;
Run Code Online (Sandbox Code Playgroud)
但是什么都没有显示
我正在尝试做的事情:阅读日志并将必要的数据插入到3个不同的表中,这些表可以互相获取信息.
LOG_ITEM201303在gamelogs db上找到.
Mail_Item_Table,Mail_List_Table,Mail_Message_Table是在游戏数据库中.
邮件表通过索引连接.
CHAR_KEY,NAME,ITEMNUM是我需要用我的查询值.
查询我从日志中获取数据:
SELECT CHAR_KEY, NAME, ITEMNUM
FROM LOG_ITEM201303
where
(
ITEMNUM = 14317
OR ITEMNUM = 14318
OR ITEMNUM = 15478
OR ITEMNUM = 15479
OR ITEMNUM = 14301
OR ITEMNUM = 14302
OR ITEMNUM = 15476
OR ITEMNUM = 15477
OR ITEMNUM = 15018
OR ITEMNUM = 15019
OR ITEMNUM = 15020
OR ITEMNUM = 15021
OR ITEMNUM = 15022
OR ITEMNUM = …Run Code Online (Sandbox Code Playgroud) 我收到了这个警告
warning C4309: 'initializing' : truncation of constant value
Run Code Online (Sandbox Code Playgroud)
当我尝试执行我的dll时,它只发送4个字节而不是10个字节.
可能有什么不对?
这是我的代码:
int WINAPI MySend(SOCKET s, const char* buf, int len, int flags)
{
cout << "[SEND:" << len << "] ";
for ( int i = 0; i < len; i++ ) {
printf( "%02x ", static_cast<unsigned char>( buf[i] ) );
}
printf("\n");
//causing the warning:
char storagepkt[] = {0x0A, 0x00, 0x01, 0x40, 0x79, 0xEA, 0x60, 0x1D, 0x6B, 0x3E};
buf = storagepkt;
len = sizeof(storagepkt);
return pSend(s, buf, len, …Run Code Online (Sandbox Code Playgroud) 使用MSSMS我正在尝试运行查询.
SELECT CONVERT(BINARY(16), 14437)
Run Code Online (Sandbox Code Playgroud)
结果是:
0x00000000000000000000000000003865
Run Code Online (Sandbox Code Playgroud)
但这正是我要找的:
0x65380000000000000000000000000000
Run Code Online (Sandbox Code Playgroud)
我尝试使用反向但没有运气.
SELECT REVERSE(CONVERT(BINARY(16), 14437))
Run Code Online (Sandbox Code Playgroud) 基于此文档:https://developer.chrome.com/extensions/webRequest.html#event-onHeadersReceived
我试图通过控制台显示响应,如:
console.log(info.responseHeaders);
但它的回归undefined.
但这有效:
console.log("Type: " + info.type);
请帮忙,我真的需要获取responseHeaders数据.
注册成功后,我想将所有数据作为 POST 传递到登录路由。你如何在 Laravel 4 中做到这一点?
我知道我可以在注册后对用户进行身份验证,但登录页面有其他参数和更多需要的身份验证过程。
所以我想把在注册过程中输入的用户名和密码推送到登录过程中,以便它可以通过登录路径中的其他过程。(例如需要 app_id 和 app_secret 的 post 数据的令牌生成)
return Response::json(array(
'status' => 200,
'posts' => $post->toArray()
), 200);
Run Code Online (Sandbox Code Playgroud)
使用上面的代码我以json格式返回数据.
我已经看到其他api的返回json在格式化视图中返回它.
喜欢:
http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid=440&count=3&maxlength=300&format=json
Run Code Online (Sandbox Code Playgroud)
但是我的回归一行.如何使用laravel以格式化方式生成json?
更新
直到明天我才能测试代码.所以我会接受汤姆的答案.
但这是api
http://laravel.com/api/class-Illuminate.Support.Facades.Response.html
Run Code Online (Sandbox Code Playgroud)
和参数是,
$data
$status
$headers
Run Code Online (Sandbox Code Playgroud)
更新
实际上我修改了照明的响应类以使其保持不变.
我目前正在尝试在 3 个表之间建立关系。
Users
uid
username
Groups
gid
groupname
GroupMembers
uid
gid
Run Code Online (Sandbox Code Playgroud)
使用 eloquent ORM,如何获取用户的组?
只需要 1 行查询,我就想返回一个 json 回复,例如:(我所属的搜索组...关键字:管理员)
Status 200
User uid 1
username mrwootwoot
Groups
{
gid 1
groupname administrators
}
{
gid 2
groupname wadmin
}
Run Code Online (Sandbox Code Playgroud)
到目前为止我得到的是:
$joined_networks = User::whereHas('groups', function($q)
{
$q->where('is_blocked', '=', 0)->where('name','like',"%admin%");
})->with('groups')->where('uid', $user_id)->get();
(...)
return Response::json(array(
'status' => 200,
'user' => $joined_networks->toArray()
));
Run Code Online (Sandbox Code Playgroud)
这部分代码假设找到用户所属的组,他没有被阻止。
更新
$joined = User::with('group')->where('uid', $user_id)->get();
return Response::json(array(
'status' => 200,
'results' => $joined
));
Run Code Online (Sandbox Code Playgroud)
和我的用户模型:
public function group() …Run Code Online (Sandbox Code Playgroud)