 |
|

19.12.2019, 23:53
|
|
Участник форума
Регистрация: 11.01.2017
Сообщений: 218
С нами:
4913302
Репутация:
98
|
|
Сообщение от ImmortalDev
Типо, оно содержит инфу, но редачить нельзя?
Почитай хотя бы базовую информацию о языке , иначе ты каждый шаг продолжишь здесь спрашивать.🤦*♂️
|
|
|

20.12.2019, 14:19
|
|
Познающий
Регистрация: 02.12.2019
Сообщений: 86
С нами:
3393864
Репутация:
23
|
|
Сообщение от Dark_Knight
Потому что ты глуп - вот почему. Ты уже данную ошибку делал и тебе рассказали как надо работать.
Да, я правда глуп и туп =). Постараюсь больше не задавать однотипные вопросы)
Сообщение от Niji
Почитай хотя бы базовую информацию о языке , иначе ты каждый шаг продолжишь здесь спрашивать.🤦*♂️
Да я просто думать не хотел и полез быстрей на форум. Больше такое не повториться, сам буду пытаться разбираться =)
|
|
|

21.12.2019, 23:18
|
|
Участник форума
Регистрация: 16.11.2018
Сообщений: 253
С нами:
3943240
Репутация:
48
|
|
как инжектить в процесс gta_sa.exe через exe file код на lua или же файл lua
|
|
|

21.12.2019, 23:25
|
|
Познавший АНТИЧАТ
Регистрация: 20.07.2017
Сообщений: 1,292
С нами:
4639746
Репутация:
183
|
|
Сообщение от sanders
как инжектить в процесс gta_sa.exe через exe file код на lua или же файл lua
luajit + luaxx.dll
ток хз что тебе даст голое луа в гташке, разве что подключить какие-то либы на работу с памятью и сделать свое крутое апи как у мунлоадера..
|
|
|

22.12.2019, 18:18
|
|
Познавший АНТИЧАТ
Регистрация: 18.08.2017
Сообщений: 1,568
С нами:
4598023
Репутация:
183
|
|
1) Вопрос:
Приветствую.
Возник вопрос касательно C++, очень желаю получить ответ с прикрепленными строчками кода и требуемыми инклудами. Смотрите.
Мне нужно сделать так, чтобы в игровой чат вместо меня писала программа. Я уже научился открывать и закрывать чат (имитация нажатия клавиши), так же у меня есть строка (string) с текстом. Надо, чтобы оно типо вводило этот текст, не смотря на текущий язык на моей клавиатуре. ЭТО НЕОБЯЗАТЕЛЬНО ДЛЯ САМПА, НЕ НАДО МНЕ КИДАТЬ ССЫЛКУ НА САМПФУНКС С УЖЕ ГОТОВОЙ ВСТРОЕННОЙ ФУНКЦИЕЙ ОТПРАВКИ СООБЩЕНИЯ.
|
|
|

24.12.2019, 00:30
|
|
Познающий
Регистрация: 08.12.2019
Сообщений: 45
С нами:
3385695
Репутация:
58
|
|
Сообщение от Vintik
1) Вопрос:
Приветствую.
Возник вопрос касательно C++, очень желаю получить ответ с прикрепленными строчками кода и требуемыми инклудами. Смотрите.
Мне нужно сделать так, чтобы в игровой чат вместо меня писала программа. Я уже научился открывать и закрывать чат (имитация нажатия клавиши), так же у меня есть строка (string) с текстом. Надо, чтобы оно типо вводило этот текст, не смотря на текущий язык на моей клавиатуре. ЭТО НЕОБЯЗАТЕЛЬНО ДЛЯ САМПА, НЕ НАДО МНЕ КИДАТЬ ССЫЛКУ НА САМПФУНКС С УЖЕ ГОТОВОЙ ВСТРОЕННОЙ ФУНКЦИЕЙ ОТПРАВКИ СООБЩЕНИЯ.
Если ты открываешь чат с помощью имитации нажатия клавиши, в чем проблема с помощью имитаций напечатать текст?
|
|
|

24.12.2019, 01:45
|
|
Участник форума
Регистрация: 19.01.2017
Сообщений: 130
С нами:
4901705
Репутация:
98
|
|
What is the best & safest way to clean std::string from memory ?
std::string example;
1. example.clear();
2. example.resize(0);
3. std::fill(example.begin(), example.end(), 0);
|
|
|

24.12.2019, 12:51
|
|
Флудер
Регистрация: 18.03.2013
Сообщений: 4,080
С нами:
6921957
Репутация:
183
|
|
example.clear(), example.shrink_to_fit();
|
|
|

24.12.2019, 23:43
|
|
Новичок
Регистрация: 11.07.2019
Сообщений: 5
С нами:
3602037
Репутация:
3
|
|
fQuaternion Hello i need help i want to know how to get my vehicle(vehicledata) on raknet to turn to the xyz i set to it, and also the code i send speed to the xyz i set to it and also the speed setting
And also forging my direction(aimdata)
|
|
|

25.12.2019, 10:28
|
|
Постоянный
Регистрация: 15.12.2013
Сообщений: 412
С нами:
6530249
Репутация:
133
|
|
Сообщение от _=Gigant=_
What is the best & safest way to clean std::string from memory ?
std::string example;
1. example.clear();
2. example.resize(0);
3. std::fill(example.begin(), example.end(), 0);
Hi there, such a cool question. Basically, have to distinguish what does "best & safest" mean in that context
By the rules of RTTI, standard definition of an object constructed in some arbitrary block (let's not include here some special cases like overloaded form of operator new()) will be destructed at the end of that block
C++:
Код:
{
std
::
string my_string
{
"String!"
}
;
// ...
// std::basic_string::~basic_string will be called
}
So you ain't gotta do that by yourself, no such need for neither .resize, nor free(), delete(), std::fill and others
In case 'safest method' stands for making sure data you operate within act must be zeroed / cleared, especially in cases when std::string will be used for storing sensitive data (passwords and others), well, there's no portable and unambiguous answer.
Doing manual .clear call does not give any guarantee that this call won't be optimized
Proof: https://godbolt.org/z/rdCQyQ
Same goes for the std::basic_string::~basic_string, it might or mightn't clear used memory
libc++, for example, does this
libcxx/include/string at master · llvm-mirror/libcxx
Project moved to: https://github.com/llvm/llvm-project - llvm-mirror/libcxx
github.com
For a kick-off, there's has to be some function to do zeroing above some memory block with confidentially that this call/expression won't be optimized away by the compiler.
You might take a look at the following:
1) memset_s from C11. Even though it must be portable, there are some problems with C11 in, for instance, Visual Studio. Moreover, __STDC_WANT_LIB_EXT1__ and __STDC_WANT_LIB_EXT1__ must be used in any platform and there's another possible issue - MacOS might not work with those macroeses.
Код:
Код:
#define __STDC_WANT_LIB_EXT1__ 1
#include
// available to use function
// errno_t memset_s(void * restrict s, rsize_t smax, int c, rsize_t n)
2) write memset_s by yourself, don't miss volatile modifier
Код:
Код:
void zerofill(void *data, size_t size) {
for (auto p = reinterpret_cast(data); size; size--) {
*(p + size) = 0;
}
}
3) User platform-provided solutions
bzero on macOS doesn't have any rule for compiler optimizations, so skip that
SecureZeroMemory on Windows does exactly what needed
SecureZeroMemory function (Windows)
docs.microsoft.com
Secondly, there's a need to know what is the way zeroing might be perfomed
1) direct data access
Before c++17, you could give a try to &str[0], but it has undefined behavior when pos == size()
Since c++17, std::basic_string::data will return non const pointer if target string was not const
2) might try std::allocator by calling std::string::get_allocator, but it's sort of deprecated
To implement this like it should be in modern c++, you can try usual class inheritance, but i'd like to recommend do this with std::unique_ptr, since it has support for the disposal function
Of course, this doesn't cover cases you're dealing with classical OOP model and can do cleaning at your class destructor
Here are the tests i've done
Сообщение от Спойлер
C++:
Код:
#include
#include
#include
#include
#include
#include
#include
char
*
get_string_data
(
std
::
string
&
str
)
{
if
constexpr
(
!
std
::
is_const
(
)
.
data
(
)
)
>
(
)
)
return
str
.
data
(
)
;
else
return
&
str
[
0
]
;
}
namespace
secure
{
static
void
safe_clear
(
void
*
data
,
size_t size
)
{
for
(
auto
p
=
reinterpret_cast
(
data
)
;
size
;
size
--
)
{
*
(
p
+
size
)
=
0
;
}
}
static
void
string_clear
(
std
::
string
*
str
)
{
safe_clear
(
reinterpret_cast
(
get_string_data
(
*
str
)
)
,
str
->
capacity
(
)
)
;
str
->
~
basic_string
(
)
;
::
operator
delete
(
str
)
;
}
}
struct
dump
{
std
::
unique_ptr
buf
;
char
*
block
;
size_t block_size
;
dump
(
std
::
string
&
str
)
{
block
=
get_string_data
(
str
)
;
block_size
=
str
.
capacity
(
)
;
buf
=
std
::
make_unique
(
block_size
)
;
std
::
copy
(
block
,
block
+
block_size
,
buf
.
get
(
)
)
;
}
static
void
print_block
(
const
char
*
dd
,
size_t size
)
{
for
(
const
char
*
p
=
dd
-
size
;
p
!=
dd
;
p
++
)
{
const
auto
c
=
*
(
p
+
size
)
;
std
::
cout
(
static_cast
(
c
)
)
using
str_seq
=
std
::
integer_sequence
;
template
constexpr
str_seq
operator
""
_s
(
)
{
return
{
}
;
}
template
struct
dump_var
;
template
struct
dump_var
>
{
static
constexpr
char
name
[
sizeof
.
.
.
(
name_c
)
+
1
]
=
{
name_c
.
.
.
,
'\0'
}
;
dump_var
(
std
::
function
f
)
{
auto
dumper
=
f
(
name
)
;
if
(
std
::
all_of
(
dumper
.
block
,
dumper
.
block
+
dumper
.
block_size
,
[
]
(
auto
v
)
{
return
v
==
0
;
}
)
)
std
::
cout
(
dumper
.
buf
.
get
(
)
)
,
dumper
.
block_size
)
;
std
::
cout
int
{
dump_var
(
[
]
(
auto
str
)
{
std
::
string
usual_way
(
str
)
;
usual_way
.
clear
(
)
;
//
(
[
]
(
auto
str
)
{
std
::
unique_ptr
>
custom_deleter
(
new
std
::
string
(
str
)
,
secure
::
string_clear
)
;
return
dump
(
*
custom_deleter
)
;
}
)
;
}
Сообщение от Спойлер
Код:
Код:
Test {Normal std::string usage blah blah blah} NOT passed!
Memory block before
0() 111(o) 114(r) 109(m) 97(a) 108(l) 32( ) 115(s) 116(t) 100(d) 58(:) 58(:) 115(s) 116(t) 114(r) 105(i) 110(n) 103(g) 32( ) 117(u) 115(s) 97(a) 103(g) 101(e) 32( ) 98(b) 108(l) 97(a) 104(h) 32( ) 98(b) 108(l) 97(a) 104(h) 32( ) 98(b) 108(l) 97(a) 104(h)
Memory block after
152(�) 43(+) 220(�) 249(�) 211(�) 127() 0() 0() 152(�) 43(+) 220(�) 249(�) 211(�) 127() 0() 0() 110(n) 103(g) 32( ) 117(u) 115(s) 97(a) 103(g) 101(e) 32( ) 98(b) 108(l) 97(a) 104(h) 32( ) 98(b) 108(l) 48(0) 0() 0() 0() 0() 0() 0()
Test {Custom deleter blah blah blah} passed!
Live: http://coliru.stacked-crooked.com/a/a08b5ab2257acbab
Think I described it in the way you needed, I mean I correctly represented a word "safest"
By the way, take a look how it's implemented in, for instance, chromium project
chromium/third_party/unrar/src/secpassword.cpp at 6efa1184771ace08f3e2162b0255c93526d1750d · chromium/chromium
The official GitHub mirror of the Chromium source. Contribute to chromium/chromium development by creating an account on GitHub.
github.com
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|